From d7b6bb274a1cc6f4e303045587b7c61e505e0fb7 Mon Sep 17 00:00:00 2001 From: "Sindhuri.A" Date: Wed, 21 Nov 2018 17:34:47 +0530 Subject: UT-InputsBusinessLogic UT for InputsBusinessLogic class Issue-ID: SDC-1775 Change-Id: Ia95f73af0af5e8abef883250c3b649b53a0cb4e9 Signed-off-by: Sindhuri.A --- .../components/impl/InputsBusinessLogicTest.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'catalog-be/src/test') diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java index 34b017778e..934a35e98a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java @@ -61,6 +61,9 @@ public class InputsBusinessLogicTest { @Mock private UserValidations userValidations; + @Mock + private ComponentInstanceBusinessLogic componentInstanceBusinessLogic; + @InjectMocks private InputsBusinessLogic testInstance; @@ -118,6 +121,32 @@ public class InputsBusinessLogicTest { assertEquals("inputId", componentInstanceInputs.left().value().get(0).getInputId()); } + @Test + public void testGetInputs() { + String userId = "userId"; + String componentId = "compId"; + Component component = new Resource(); + when(toscaOperationFacadeMock.getToscaElement(Mockito.any(String.class), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(component)); + testInstance.getInputs(userId, componentId); + assertEquals(null, component.getInputs()); + } + + @Test + public void testGetCIPropertiesByInputId() { + Either, ResponseFormat> result; + String userId = "userId"; + String componentId = "compId"; + Component component = new Resource(); + List listDef = new ArrayList<>(); + InputDefinition inputDef = new InputDefinition(); + inputDef.setUniqueId(componentId); + listDef.add(inputDef); + component.setInputs(listDef); + when(toscaOperationFacadeMock.getToscaElement(Mockito.any(String.class), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(component)); + result = testInstance.getComponentInstancePropertiesByInputId(userId, componentId, componentId, componentId); + assertTrue(result.isLeft()); + } + private void getComponents_emptyInputs(Service service) { when(toscaOperationFacadeMock.getToscaElement(eq(COMPONENT_ID), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(service)); Either, ResponseFormat> componentInstanceInputs = testInstance.getComponentInstanceInputs(USER_ID, COMPONENT_ID, COMPONENT_INSTANCE_ID); -- cgit 1.2.3-korg