X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=bpmn%2Fso-bpmn-infrastructure-common%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fso%2Fbpmn%2Finfrastructure%2Fpnf%2Fdelegate%2FCheckAaiForCorrelationIdDelegateTest.java;h=eeda355f80630fc97b85ddd9b40884423cbed0ca;hb=f1435439699e4e08d2bf912634208e18c894722f;hp=3eb3bd8796ad6ed0cebfe25009d4d76cded738c6;hpb=54788d599d58389d54557ec96cb50a127ffce173;p=so.git diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java index 3eb3bd8796..eeda355f80 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java @@ -20,9 +20,8 @@ package org.onap.so.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.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -34,8 +33,10 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.experimental.runners.Enclosed; +import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.onap.so.bpmn.core.WorkflowException; @@ -45,6 +46,9 @@ public class CheckAaiForCorrelationIdDelegateTest { public static class ConnectionOkTests { private CheckAaiForCorrelationIdDelegate delegate; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); @Before public void setUp() { @@ -53,13 +57,14 @@ public class CheckAaiForCorrelationIdDelegateTest { } @Test - public void shouldThrowExceptionWhenCorrelationIdIsNotSet() { + public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); when(execution.getVariable(CORRELATION_ID)).thenReturn(null); when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); // when, then - assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); + expectedException.expect(BpmnError.class); + delegate.execute(execution); verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); } @@ -89,6 +94,9 @@ public class CheckAaiForCorrelationIdDelegateTest { public static class NoConnectionTests { private CheckAaiForCorrelationIdDelegate delegate; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); @Before public void setUp() { @@ -97,13 +105,14 @@ public class CheckAaiForCorrelationIdDelegateTest { } @Test - public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() { + public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey"); // when, then - assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); + expectedException.expect(BpmnError.class); + delegate.execute(execution); verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); } }