diff options
author | biniek <lukasz.biniek@nokia.com> | 2018-10-19 10:45:54 +0200 |
---|---|---|
committer | biniek <lukasz.biniek@nokia.com> | 2018-10-23 13:26:46 +0200 |
commit | 272699e945959d50e125683102898e681b90e761 (patch) | |
tree | e47d8c93fb22a7654b6f85ddd080dbdc8c60d582 /bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap | |
parent | 60f8f5342f1fba49373699c1466e6ca06d1adc34 (diff) |
Simplify Aai connection result
Change-Id: Ibbe0f1b9c8fff3b2557161ac2386d21e417ec491
Issue-ID: SO-1148
Signed-off-by: biniek <lukasz.biniek@nokia.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap')
-rw-r--r-- | bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java | 22 |
1 files changed, 20 insertions, 2 deletions
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; @@ -69,6 +77,16 @@ public class PnfCheckInputsTest { } @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 PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); |