1b5b7d8a7ee6f6877ebd53a897a0bf3c44282236
[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 static org.junit.jupiter.api.Assertions.assertNotNull;
22 import static org.junit.jupiter.api.Assertions.assertNull;
23
24 import org.junit.jupiter.api.BeforeEach;
25 import org.junit.jupiter.api.Test;
26 import org.junit.jupiter.api.extension.ExtendWith;
27 import org.mockito.InjectMocks;
28 import org.mockito.Mockito;
29 import org.mockito.junit.jupiter.MockitoExtension;
30 import org.openecomp.sdc.be.model.Service;
31 import org.openecomp.sdc.be.model.UploadServiceInfo;
32
33 @ExtendWith(MockitoExtension.class)
34 class ServiceImportManagerTest {
35
36     private final ServiceBusinessLogic serviceBusinessLogic = Mockito.mock(ServiceBusinessLogic.class);
37     @InjectMocks
38     private ServiceImportManager serviceImportManager;
39
40     @BeforeEach
41     public void setup() {
42         serviceImportManager = new ServiceImportManager();
43     }
44
45     private ServiceImportManager createTestSubject() {
46         return new ServiceImportManager();
47     }
48
49     @Test
50     void testGetServiceImportBusinessLogic() {
51         ServiceImportManager testSubject;
52         ServiceImportBusinessLogic result;
53
54         testSubject = createTestSubject();
55         result = testSubject.getServiceImportBusinessLogic();
56         assertNull(result);
57     }
58
59     @Test
60     void testSetServiceImportBusinessLogic() {
61         ServiceImportManager testSubject;
62         ServiceImportBusinessLogic serviceImportBusinessLogic = null;
63
64         testSubject = createTestSubject();
65         testSubject.setServiceImportBusinessLogic(serviceImportBusinessLogic);
66         assertNotNull(testSubject);
67     }
68
69     @Test
70     void testGetServiceBusinessLogic() {
71         ServiceImportManager testSubject;
72         ServiceBusinessLogic result;
73
74         testSubject = createTestSubject();
75         result = testSubject.getServiceBusinessLogic();
76         assertNull(result);
77     }
78
79     @Test
80     void testSetServiceBusinessLogic() {
81         ServiceImportManager testSubject;
82         ServiceBusinessLogic serviceBusinessLogic = null;
83
84         testSubject = createTestSubject();
85         testSubject.setServiceBusinessLogic(serviceBusinessLogic);
86         assertNotNull(testSubject);
87     }
88
89     @Test
90     void testPopulateServiceMetadata() {
91         UploadServiceInfo serviceMetaData = new UploadServiceInfo();
92         serviceMetaData.setDescription("Description");
93         serviceMetaData.setVendorName("VendorName");
94         serviceMetaData.setVendorRelease("VendorRelease");
95         Service service = new Service();
96         service.setName("service");
97         serviceImportManager.populateServiceMetadata(serviceMetaData, service);
98     }
99 }