diff options
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java | 87 |
1 files changed, 41 insertions, 46 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java index 8109e36be1..e726f608f5 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java @@ -20,15 +20,7 @@ package org.openecomp.sdc.be.components.impl; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; - +import fj.data.Either; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -42,51 +34,54 @@ import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; -import org.slf4j.Logger; -import fj.data.Either; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; -public class InterfaceLifecycleTypeImportManagerTest { +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; - @InjectMocks - private InterfaceLifecycleTypeImportManager importManager = new InterfaceLifecycleTypeImportManager(); - public static final CommonImportManager commonImportManager = Mockito.mock(CommonImportManager.class); - public static final IInterfaceLifecycleOperation interfaceLifecycleOperation = Mockito.mock(IInterfaceLifecycleOperation.class); - public static final ComponentsUtils componentsUtils = Mockito.mock(ComponentsUtils.class); +public class InterfaceLifecycleTypeImportManagerTest { - static Logger log = Mockito.spy(Logger.class); + @InjectMocks + private InterfaceLifecycleTypeImportManager importManager = new InterfaceLifecycleTypeImportManager(); + public static final CommonImportManager commonImportManager = Mockito.mock(CommonImportManager.class); + public static final IInterfaceLifecycleOperation interfaceLifecycleOperation = Mockito.mock(IInterfaceLifecycleOperation.class); + public static final ComponentsUtils componentsUtils = Mockito.mock(ComponentsUtils.class); - @BeforeClass - public static void beforeClass() throws IOException { - InterfaceLifecycleTypeImportManager.setLog(log); - when(interfaceLifecycleOperation.createInterfaceType(Mockito.any(InterfaceDefinition.class))).thenAnswer(new Answer<Either<InterfaceDefinition, StorageOperationStatus>>() { - public Either<InterfaceDefinition, StorageOperationStatus> answer(InvocationOnMock invocation) { - Object[] args = invocation.getArguments(); - Either<InterfaceDefinition, StorageOperationStatus> ans = Either.left((InterfaceDefinition) args[0]); - return ans; - } + @BeforeClass + public static void beforeClass() throws IOException { + when(interfaceLifecycleOperation.createInterfaceType(Mockito.any(InterfaceDefinition.class))).thenAnswer(new Answer<Either<InterfaceDefinition, StorageOperationStatus>>() { + public Either<InterfaceDefinition, StorageOperationStatus> answer(InvocationOnMock invocation) { + Object[] args = invocation.getArguments(); + Either<InterfaceDefinition, StorageOperationStatus> ans = Either.left((InterfaceDefinition) args[0]); + return ans; + } - }); - when(commonImportManager.createElementTypesFromYml(Mockito.anyString(), Mockito.any())).thenCallRealMethod(); - } + }); + when(commonImportManager.createElementTypesFromYml(Mockito.anyString(), Mockito.any())).thenCallRealMethod(); + } - @Before - public void initMocks() { - MockitoAnnotations.initMocks(this); - } + @Before + public void initMocks() { + MockitoAnnotations.initMocks(this); + } - @Test - public void importLiecycleTest() throws IOException { - String ymlContent = getYmlContent(); - Either<List<InterfaceDefinition>, ResponseFormat> createCapabilityTypes = importManager.createLifecycleTypes(ymlContent); - assertTrue(createCapabilityTypes.isLeft()); + @Test + public void importLiecycleTest() throws IOException { + String ymlContent = getYmlContent(); + Either<List<InterfaceDefinition>, ResponseFormat> createCapabilityTypes = importManager.createLifecycleTypes(ymlContent); + assertTrue(createCapabilityTypes.isLeft()); - } + } - private String getYmlContent() throws IOException { - Path filePath = Paths.get("src/test/resources/types/interfaceLifecycleTypes.yml"); - byte[] fileContent = Files.readAllBytes(filePath); - String ymlContent = new String(fileContent); - return ymlContent; - } + private String getYmlContent() throws IOException { + Path filePath = Paths.get("src/test/resources/types/interfaceLifecycleTypes.yml"); + byte[] fileContent = Files.readAllBytes(filePath); + String ymlContent = new String(fileContent); + return ymlContent; + } } |