From 272699e945959d50e125683102898e681b90e761 Mon Sep 17 00:00:00 2001 From: biniek Date: Fri, 19 Oct 2018 10:45:54 +0200 Subject: Simplify Aai connection result Change-Id: Ibbe0f1b9c8fff3b2557161ac2386d21e417ec491 Issue-ID: SO-1148 Signed-off-by: biniek --- .../pnf/delegate/PnfCheckInputsTest.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap') diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index 2e8fb4be78..9794a59534 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -37,7 +37,6 @@ public class PnfCheckInputsTest { private static final String DEFAULT_TIMEOUT = "P1D"; private DelegateExecution mockDelegateExecution() { - new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mock(DelegateExecution.class); when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); return delegateExecution; @@ -52,8 +51,17 @@ public class PnfCheckInputsTest { assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } + @Test + public void shouldThrowException_whenPnfIdIsEmptyString() throws Exception { + // given + PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); + DelegateExecution delegateExecution = mockDelegateExecution(); + when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn(""); + // when, then + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + private DelegateExecution mockDelegateExecutionWithCorrelationId() { - new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mockDelegateExecution(); when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId"); return delegateExecution; @@ -68,6 +76,16 @@ public class PnfCheckInputsTest { assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } + @Test + public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() throws Exception { + // given + PnfCheckInputs testedObject = new PnfCheckInputs(null); + DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); + when(delegateExecution.getVariable(TIMEOUT_FOR_NOTIFICATION)).thenReturn(""); + // when, then + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + @Test public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() { // given -- cgit 1.2.3-korg