From cafd0137bce8c5f5344a2b8d249904503e0c1af3 Mon Sep 17 00:00:00 2001 From: biniek Date: Thu, 5 Apr 2018 11:09:10 +0200 Subject: Added creating WorkflowException in pnf-pnp Change-Id: I3cd5932913e58983c85e63c84c5136d04b0489e8 Issue-ID: SO-506 Signed-off-by: biniek --- .../pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN/src/test') diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java index d98a395838..75a7450434 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java @@ -21,10 +21,11 @@ package org.openecomp.mso.bpmn.infrastructure.pnf.delegate; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.DEFAULT_IP; import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY; import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP; import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP; @@ -38,6 +39,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Test; import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; +import org.openecomp.mso.bpmn.core.WorkflowException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -60,8 +62,7 @@ public class CheckAaiForCorrelationIdDelegateTest { when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); // when, then assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); - // todo: uncomment line below after fixing Execution -> DelecateExecution in groovy scripts -// verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); + verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); } @Test @@ -118,12 +119,14 @@ public class CheckAaiForCorrelationIdDelegateTest { private CheckAaiForCorrelationIdDelegate delegate; @Test - public void shouldThrowExceptionWhenSSADFDSADSFDS() throws Exception { + public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP); + when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey"); // when, then assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); + verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); } } } \ No newline at end of file -- cgit 1.2.3-korg