diff options
author | Steve Smokowski <ss835w@att.com> | 2019-04-05 13:45:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-05 13:45:29 +0000 |
commit | 8dcb6c2cfe69e95e22601eb1b15b6cbaa6b8746a (patch) | |
tree | 03f0eac860c489f81c31158f9e34885ca79369fc /bpmn/MSOCommonBPMN/src/test/java | |
parent | 7350292687c521002a4abbcc9f1d24cc37caf13f (diff) | |
parent | 608a077f8ea3b18dddbfeb4d8b486661e05561c7 (diff) |
Merge "Fixed Sonar blocker issues"
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java index b2812d9bfb..161f879716 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java @@ -20,28 +20,36 @@ package org.onap.so.client.cds; -import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; +import org.onap.so.client.exception.ExceptionBuilder; -@RunWith(JUnit4.class) +@RunWith(MockitoJUnitRunner.class) public class AbstractCDSProcessingBBUtilsTest { @InjectMocks private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils = new AbstractCDSProcessingBBUtils(); @InjectMocks AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean(); + @Mock + ExceptionBuilder exceptionUtil; - @Test - public void preProcessRequestTest() throws Exception { + @Before + public void init(){ String requestObject = "{\"config-assign-request\":{\"resolution-key\":\"resolutionKey\", \"config-assign-properties\":{\"service-instance-id\":\"serviceInstanceId\", \"vnf-id\":\"vnfId\", \"vnf-name\":\"vnfName\", \"service-model-uuid\":\"serviceModelUuid\", \"vnf-customization-uuid\":\"vnfCustomizationUuid\",\"Instance1\":\"Instance1Value\",\"Instance2\":\"Instance2Value\",\"Param3\":\"Param3Value\"}}}"; String blueprintName = "blueprintName"; String blueprintVersion = "blueprintVersion"; @@ -59,12 +67,28 @@ public class AbstractCDSProcessingBBUtilsTest { abstractCDSPropertiesBean.setRequestId(requestId); abstractCDSPropertiesBean.setRequestObject(requestObject); abstractCDSPropertiesBean.setSubRequestId(subRequestId); + } + + @Test + public void preProcessRequestTest() throws Exception { DelegateExecution execution = mock(DelegateExecution.class); when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean); abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution); - assertTrue(true); + verify(exceptionUtil, times(0)) + .buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(Exception.class)); + } + + @Test + public void sendRequestToCDSClientTest() { + + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable("executionServiceInput")).thenReturn(abstractCDSPropertiesBean); + abstractCDSProcessingBBUtils.sendRequestToCDSClient(execution); + verify(exceptionUtil, times(1)) + .buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(Exception.class)); + } } |