2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2019 China Mobile
6 * Copyright (C) 2022 Wipro Limited.
7 *=================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.datalake.feeder.controller;
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.junit.runner.RunWith;
27 import org.mockito.InjectMocks;
28 import org.mockito.Mock;
29 import org.mockito.MockitoAnnotations;
30 import org.mockito.junit.MockitoJUnitRunner;
31 import org.onap.datalake.feeder.domain.DesignType;
32 import org.onap.datalake.feeder.dto.DesignTypeConfig;
33 import org.onap.datalake.feeder.repository.DesignTypeRepository;
34 import org.onap.datalake.feeder.service.DesignTypeService;
36 import java.util.ArrayList;
37 import java.util.List;
39 import static org.junit.Assert.assertNotNull;
40 import static org.mockito.Mockito.when;
42 @RunWith(MockitoJUnitRunner.class)
43 public class DesignTypeControllerTest {
46 private DesignTypeRepository designTypeRepository;
49 private DesignTypeService designTypeService;
52 private DesignTypeController designTypeController;
55 public void setupTest() {
56 MockitoAnnotations.initMocks(this);
59 public DesignType fillDomain() {
60 DesignType designType = new DesignType();
61 designType.setName("Kibana Dashboard");
66 public void testGetDesignType() {
67 List < DesignTypeConfig > designTypeNamesList = new ArrayList < > ();
68 List < DesignType > designTypeList = new ArrayList < > ();
69 DesignType designType = fillDomain();
70 designTypeList.add(designType);
71 when(designTypeService.getDesignTypes()).thenReturn(designTypeNamesList);
72 assertNotNull(designTypeController.getDesignType());