From 9b6476f1117ef2310f5a2d7cb514b0736564c8c7 Mon Sep 17 00:00:00 2001 From: Lukasz Muszkieta <lukasz.muszkieta@nokia.com> Date: Thu, 21 Feb 2019 16:23:29 +0100 Subject: remove unneeded code Change-Id: Ib1a62a8cf3a0335bf163ca2634c86e95d2a258b8 Issue-ID: SO-729 Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com> --- .../pnf/delegate/PnfCheckInputsTest.java | 37 ++++++++-------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-common/src/test/java') 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 1637b1a97f..80693d7ce6 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 @@ -20,14 +20,13 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; import java.util.UUID; +import org.apache.commons.lang3.StringUtils; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; @@ -36,7 +35,7 @@ import org.junit.Test; public class PnfCheckInputsTest { - private static final String DEFAULT_TIMEOUT = "P1D"; + private static final String PNF_ENTRY_NOTIFICATION_TIMEOUT = "P1D"; private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString(); private static final String RESERVED_UUID = new UUID(0, 0).toString(); private static final String DEFAULT_SERVICE_INSTANCE_ID = "da7d07d9-b71c-4128-809d-2ec01c807169"; @@ -51,50 +50,49 @@ public class PnfCheckInputsTest { @Test public void shouldThrowException_whenCorrelationIdNotSet() { - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); + PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT); DelegateExecution execution = delegateExecutionBuilder.setCorrelationId(null).setPnfUuid(VALID_UUID).build(); assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @Test - public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() { + public void shouldThrowException_whenPnfEntryNotificationTimeoutIsNull() { PnfCheckInputs testedObject = new PnfCheckInputs(null); - DelegateExecution execution = delegateExecutionBuilder.setTimeoutForNotification("").build(); + DelegateExecution execution = delegateExecutionBuilder.build(); assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @Test - public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() { - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution execution = delegateExecutionBuilder.setTimeoutForNotification(null).build(); - testedObject.execute(execution); - assertThat(execution.getVariable(TIMEOUT_FOR_NOTIFICATION)).isEqualTo(DEFAULT_TIMEOUT); + public void shouldThrowException_whenPnfEntryNotificationTimeoutIsEmpty() { + PnfCheckInputs testedObject = new PnfCheckInputs(StringUtils.EMPTY); + DelegateExecution execution = delegateExecutionBuilder.build(); + assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @Test public void shouldThrowException_whenPnfUuidIsNotSet() { - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); + PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT); DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(null).build(); assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @Test public void shouldThrowException_whenPnfUuidIsEmptyString() { - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution execution = delegateExecutionBuilder.setPnfUuid("").build(); + PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT); + DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(StringUtils.EMPTY).build(); assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @Test public void shouldThrowException_whenPnfUuidIsReservedUuid() { - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); + PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT); DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(RESERVED_UUID).build(); assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @Test public void shouldThrowException_whenServiceInstanceIdIsNotSet() { - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); + PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT); DelegateExecution execution = delegateExecutionBuilder.setServiceInstanceId(null).build(); assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @@ -103,7 +101,6 @@ public class PnfCheckInputsTest { private String correlationId = DEFAULT_CORRELATION_ID; private String pnfUuid = VALID_UUID; private String serviceInstanceId = DEFAULT_SERVICE_INSTANCE_ID; - private String timeoutForNotification; public DelegateExecutionBuilder setCorrelationId(String correlationId) { this.correlationId = correlationId; @@ -120,18 +117,12 @@ public class PnfCheckInputsTest { return this; } - public DelegateExecutionBuilder setTimeoutForNotification(String timeoutForNotification) { - this.timeoutForNotification = timeoutForNotification; - return this; - } - public DelegateExecution build() { DelegateExecution execution = new DelegateExecutionFake(); execution.setVariable("testProcessKey", "testProcessKeyValue"); execution.setVariable(CORRELATION_ID, this.correlationId); execution.setVariable(PNF_UUID, this.pnfUuid); execution.setVariable(SERVICE_INSTANCE_ID, this.serviceInstanceId); - execution.setVariable(TIMEOUT_FOR_NOTIFICATION, this.timeoutForNotification); return execution; } } -- cgit 1.2.3-korg