From 6f44e217b73e2eca6abd00ffabb67e1aa4fca237 Mon Sep 17 00:00:00 2001 From: vidhyasree Date: Thu, 31 May 2018 23:49:10 -0400 Subject: ConfigScaleOut-Payload parameter to manadatory Issue-ID: APPC-929 Change-Id: Ifd0b8f303dd77acbf37774f749b9063dc67e7620 Signed-off-by: vidhyasree --- .../provider/lcm/service/ConfigScaleOutServiceTest.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'appc-provider/appc-provider-bundle/src/test/java/org/onap') diff --git a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/ConfigScaleOutServiceTest.java b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/ConfigScaleOutServiceTest.java index e46bb91ba..bb5e953a0 100644 --- a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/ConfigScaleOutServiceTest.java +++ b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/ConfigScaleOutServiceTest.java @@ -30,6 +30,7 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.internal.util.reflection.Whitebox; import org.mockito.runners.MockitoJUnitRunner; +import org.onap.appc.util.JsonUtil; import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.*; import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.action.identifiers.ActionIdentifiers; import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.CommonHeader; @@ -39,6 +40,8 @@ import org.onap.appc.executor.objects.LCMCommandStatus; import org.onap.appc.requesthandler.objects.RequestHandlerOutput; import org.onap.appc.requesthandler.objects.RequestHandlerInput; +import java.util.Map; + import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -56,6 +59,7 @@ public class ConfigScaleOutServiceTest { private ConfigScaleOutService configscaleoutServiceAction; @Before public void setUp() throws Exception { + configscaleoutServiceAction = spy(new ConfigScaleOutService()); } @@ -149,20 +153,23 @@ public class ConfigScaleOutServiceTest { configscaleoutServiceAction.validate(mockCommonHeader, Action.ConfigScaleOut, mockAI, null); Mockito.verify(configscaleoutServiceAction, times(1)).validateExcludedActIds(any(), any()); status = (Status) Whitebox.getInternalState(configscaleoutServiceAction, "status"); - Assert.assertTrue("Should skip Payload",true); + Assert.assertEquals("should return missing parameter", + Integer.valueOf(LCMCommandStatus.MISSING_MANDATORY_PARAMETER.getResponseCode()), status.getCode()); // test empty payload Mockito.doReturn("").when(mockPayload).getValue(); configscaleoutServiceAction.validate(mockCommonHeader, Action.ConfigScaleOut, mockAI, mockPayload); status = (Status) Whitebox.getInternalState(configscaleoutServiceAction, "status"); - Assert.assertTrue("Should skip Payload",true); + Assert.assertEquals("should return invalid parameter", + Integer.valueOf(LCMCommandStatus.INVALID_INPUT_PARAMETER.getResponseCode()), status.getCode()); // test space payload Mockito.doReturn(" ").when(mockPayload).getValue(); configscaleoutServiceAction.validate(mockCommonHeader, Action.ConfigScaleOut, mockAI, mockPayload); status = (Status) Whitebox.getInternalState(configscaleoutServiceAction, "status"); - Assert.assertTrue("Should skip Payload",true); + Assert.assertEquals("should return invalid parameter", + Integer.valueOf(LCMCommandStatus.INVALID_INPUT_PARAMETER.getResponseCode()), status.getCode()); } } -- cgit 1.2.3-korg