f723a1523f0ebe5c67216dc7d2bf76fb626e01c4
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / impl / ServiceImportManagerTest.java
1 /*
2  * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15
16  */
17
18 package org.openecomp.sdc.be.components.impl;
19
20
21 import org.junit.jupiter.api.BeforeEach;
22 import org.junit.jupiter.api.Test;
23 import org.junit.jupiter.api.extension.ExtendWith;
24 import org.mockito.InjectMocks;
25 import org.mockito.Mockito;
26 import org.mockito.junit.jupiter.MockitoExtension;
27 import org.openecomp.sdc.be.model.Service;
28 import org.openecomp.sdc.be.model.UploadServiceInfo;
29
30 import static org.junit.jupiter.api.Assertions.assertNotNull;
31 import static org.junit.jupiter.api.Assertions.assertNull;
32
33 @ExtendWith(MockitoExtension.class)
34 class ServiceImportManagerTest {
35
36     @InjectMocks
37     private ServiceImportManager serviceImportManager;
38
39     public static final ServiceBusinessLogic serviceBusinessLogic = Mockito.mock(ServiceBusinessLogic.class);
40
41     @BeforeEach
42     public void setup() {
43         serviceImportManager = new ServiceImportManager();
44     }
45
46     private ServiceImportManager createTestSubject() {
47         return new ServiceImportManager();
48     }
49
50     @Test
51     void testGetServiceImportBusinessLogic() {
52         ServiceImportManager testSubject;
53         ServiceImportBusinessLogic result;
54
55         testSubject = createTestSubject();
56         result = testSubject.getServiceImportBusinessLogic();
57         assertNull(result);
58     }
59
60     @Test
61     void testSetServiceImportBusinessLogic() {
62         ServiceImportManager testSubject;
63         ServiceImportBusinessLogic serviceImportBusinessLogic = null;
64
65         testSubject = createTestSubject();
66         testSubject.setServiceImportBusinessLogic(serviceImportBusinessLogic);
67         assertNotNull(testSubject);
68     }
69
70     @Test
71     void testGetServiceBusinessLogic() {
72         ServiceImportManager testSubject;
73         ServiceBusinessLogic result;
74
75         testSubject = createTestSubject();
76         result = testSubject.getServiceBusinessLogic();
77         assertNull(result);
78     }
79
80     @Test
81     void testSetServiceBusinessLogic() {
82         ServiceImportManager testSubject;
83         ServiceBusinessLogic serviceBusinessLogic = null;
84
85         testSubject = createTestSubject();
86         testSubject.setServiceBusinessLogic(serviceBusinessLogic);
87         assertNotNull(testSubject);
88     }
89
90     @Test
91     void testPopulateServiceMetadata() {
92         UploadServiceInfo serviceMetaData = new UploadServiceInfo();
93         serviceMetaData.setDescription("Description");
94         serviceMetaData.setVendorName("VendorName");
95         serviceMetaData.setVendorRelease("VendorRelease");
96         Service service = new Service();
97         service.setName("service");
98         serviceImportManager.populateServiceMetadata(serviceMetaData, service);
99     }
100 }