summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/test
diff options
context:
space:
mode:
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.java22
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);