diff options
author | Rob Daugherty <rd472p@att.com> | 2018-10-29 13:40:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-29 13:40:43 +0000 |
commit | f33aa5c6da5e4113971f24f8e88693796800d09a (patch) | |
tree | a9d8f3b2c37756519fb819a4e38606e6a289fb1b /bpmn/so-bpmn-infrastructure-common/src/test | |
parent | f0884915f5249d60f7874a68593cfa4cc1e84681 (diff) | |
parent | 272699e945959d50e125683102898e681b90e761 (diff) |
Merge "Simplify Aai connection result"
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/test')
-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); |