aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-07-21 09:55:38 -0400
committerJim Hahn <jrh3@att.com>2020-07-21 16:25:53 -0400
commit248a660d61fa03caa4710cf8cfe144eb245b807b (patch)
tree9f7c9aa7fda6d9ab9977bf2398a0136a787dc62a
parentf203526d0f86d385976da394bd1f0f918e4445d9 (diff)
Fix some sonars in policy-models
Fixed the following sonar issues in some of the project directories: - use assertNull, assertEquals, etc. - swap assertEquals arguments - extract a constant - don't invoke toString() in logger calls - TODOs - generic types Issue-ID: POLICY-2714 Change-Id: Id8803f9bf617ea9fc173a67b8606600709b55bdc Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java2
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java6
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java5
-rw-r--r--models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java2
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java5
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java3
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java2
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java10
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java4
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java7
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java4
-rw-r--r--models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java3
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingActorParams.java1
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingParams.java1
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/ListenerManager.java1
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java3
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperatorTest.java4
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActorTest.java3
-rw-r--r--models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java50
-rw-r--r--models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java4
-rw-r--r--models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java42
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java73
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java11
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java39
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java39
-rw-r--r--models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java14
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java13
-rw-r--r--models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java11
-rw-r--r--models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java63
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java11
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java11
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java11
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java11
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java65
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java39
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java22
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java45
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java22
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java31
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java52
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java18
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java8
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java9
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java18
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java8
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java6
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java10
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java21
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java8
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java10
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java9
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java8
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java19
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java11
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java15
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java12
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java11
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java4
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java6
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java5
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java5
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java8
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java4
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java4
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java5
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java7
-rw-r--r--models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java7
74 files changed, 469 insertions, 550 deletions
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
index c6e273d50..173eb2908 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
@@ -60,7 +60,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.policy.PolicyResult;
-public class AaiCustomQueryOperationTest extends BasicAaiOperation<Map<String, String>> {
+public class AaiCustomQueryOperationTest extends BasicAaiOperation {
private static final StandardCoder coder = new StandardCoder();
private static final String MY_LINK = "my-link";
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java
index 673b6519b..df0dbff98 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java
@@ -40,7 +40,7 @@ import org.onap.policy.aai.AaiConstants;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-public class AaiGetOperationTest extends BasicAaiOperation<Void> {
+public class AaiGetOperationTest extends BasicAaiOperation {
private static final String MY_NAME = "my-operation-name";
private static final String PARAM_NAME = "my-param";
private static final String PARAM_VALUE = "my-value";
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
index d197789ca..042b64f60 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
@@ -44,7 +44,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.policy.PolicyResult;
-public class AaiGetPnfOperationTest extends BasicAaiOperation<Void> {
+public class AaiGetPnfOperationTest extends BasicAaiOperation {
private static final String INPUT_FIELD = "input";
private static final String TEXT = "my-text";
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
index 1e9a1d987..be8a26416 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
@@ -44,7 +44,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.policy.PolicyResult;
-public class AaiGetTenantOperationTest extends BasicAaiOperation<Void> {
+public class AaiGetTenantOperationTest extends BasicAaiOperation {
private static final String INPUT_FIELD = "input";
private static final String TEXT = "my-text";
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java
index ae38cca35..ca8233a4d 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java
@@ -23,7 +23,7 @@ package org.onap.policy.controlloop.actor.aai;
import java.util.Map;
import org.junit.Test;
-public class AaiUtilTest extends BasicAaiOperation<Void> {
+public class AaiUtilTest extends BasicAaiOperation {
@Test
public void testMakeHeaders() {
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
index 2715bfe29..1f481ae0f 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
@@ -32,7 +32,7 @@ import org.onap.policy.simulators.Util;
/**
* Superclass for various operator tests.
*/
-public abstract class BasicAaiOperation<Q> extends BasicHttpOperation<Q> {
+public abstract class BasicAaiOperation extends BasicHttpOperation {
/**
* Constructs the object using a default actor and operation name.
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
index 546a38d3a..1a8c60350 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
@@ -32,6 +32,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.function.BiConsumer;
+import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
import org.onap.policy.appc.ResponseStatus;
@@ -53,7 +54,7 @@ import org.powermock.reflect.Whitebox;
/**
* Superclass for various operator tests.
*/
-public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperation {
+public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperation<Request> {
protected static final String[] IGNORE_FIELDS = {"RequestID", "subRequestID", "TimeStamp"};
protected static final String MY_DESCRIPTION = "my-description";
protected static final String MY_VNF = "my-vnf";
@@ -102,8 +103,7 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio
super.tearDownBasic();
}
- @SuppressWarnings("rawtypes")
- protected TopicServer makeServer(TopicSink sink, TopicSource source) {
+ protected TopicServer<Request> makeServer(TopicSink sink, TopicSource source) {
return new AppcLegacyTopicServer(sink, source);
}
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
index fcfb6b868..6059cb5ed 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
@@ -63,7 +63,7 @@ import org.onap.policy.controlloop.policy.Target;
import org.onap.policy.simulators.AppcLcmTopicServer;
import org.onap.policy.simulators.TopicServer;
-public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
+public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcLcmDmaapWrapper> {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String PAYLOAD_KEY1 = "key-A";
@@ -103,8 +103,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
super.tearDownBasic();
}
- @SuppressWarnings("rawtypes")
- protected TopicServer makeServer(TopicSink sink, TopicSource source) {
+ protected TopicServer<AppcLcmDmaapWrapper> makeServer(TopicSink sink, TopicSource source) {
return new AppcLcmTopicServer(sink, source);
}
diff --git a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
index da0ee95b5..6fe8ceac2 100644
--- a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
+++ b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
@@ -54,7 +54,7 @@ import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.simulators.GuardSimulatorJaxRs;
-public class DecisionOperationTest extends BasicHttpOperation<DecisionRequest> {
+public class DecisionOperationTest extends BasicHttpOperation {
@Mock
private Consumer<OperationOutcome> started;
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java
index 5cc09560f..8c45bc303 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java
@@ -52,7 +52,7 @@ import org.powermock.reflect.Whitebox;
/**
* Superclass for various operator tests.
*/
-public abstract class BasicSdncOperation extends BasicHttpOperation<SdncRequest> {
+public abstract class BasicSdncOperation extends BasicHttpOperation {
/**
* Fields to be ignored when comparing requests with JSON.
*/
diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java
index 15f919b21..385052fec 100644
--- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java
+++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java
@@ -49,7 +49,7 @@ import org.onap.policy.simulators.SdnrTopicServer;
import org.onap.policy.simulators.TopicServer;
import org.powermock.reflect.Whitebox;
-public abstract class BasicSdnrOperation extends BasicBidirectionalTopicOperation {
+public abstract class BasicSdnrOperation extends BasicBidirectionalTopicOperation<PciMessage> {
protected PciMessage response;
@@ -94,8 +94,7 @@ public abstract class BasicSdnrOperation extends BasicBidirectionalTopicOperatio
super.tearDownBasic();
}
- @SuppressWarnings("rawtypes")
- protected TopicServer makeServer(TopicSink sink, TopicSource source) {
+ protected TopicServer<PciMessage> makeServer(TopicSink sink, TopicSource source) {
return new SdnrTopicServer(sink, source);
}
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
index c67243f9f..dc8b0d606 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
@@ -134,7 +134,6 @@ public class VfModuleDelete extends SoOperation {
* HttpClient, as the JerseyClient does not support it. This will add the content-type
* and authorization headers, so they should not be included within "headers".
*
- * @param <Q> request type
* @param uri URI suffix, to be appended to the URI prefix
* @param headers headers to be included
* @param contentType content type of the request
@@ -143,7 +142,7 @@ public class VfModuleDelete extends SoOperation {
* @return a future to await the response. Note: it's untested whether canceling this
* future will actually cancel the underlying HTTP request
*/
- protected <Q> CompletableFuture<Response> delete(String uri, Map<String, Object> headers, String contentType,
+ protected CompletableFuture<Response> delete(String uri, Map<String, Object> headers, String contentType,
String request, InvocationCallback<Response> callback) {
// TODO move to HttpOperation
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java
index c8afab450..3541333c0 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java
@@ -47,7 +47,7 @@ import org.onap.policy.so.SoResponse;
/**
* Superclass for various operator tests.
*/
-public abstract class BasicSoOperation extends BasicHttpOperation<SoRequest> {
+public abstract class BasicSoOperation extends BasicHttpOperation {
protected static final String[] IGNORE_FIELDS = {"RequestID", "subRequestID", "seconds", "nanos"};
public static final String MODEL_CUSTOM_ID = "my-model-customization-id";
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
index c8b69677f..fc4545966 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
@@ -45,8 +45,10 @@ import org.onap.policy.simulators.Util;
/**
* Superclass for various BidirectionalTopicOperation tests.
+ *
+ * @param <Q> request type
*/
-public abstract class BasicBidirectionalTopicOperation extends BasicOperation {
+public abstract class BasicBidirectionalTopicOperation<Q> extends BasicOperation {
protected static final String MY_SINK = "my-sink";
protected static final String MY_SOURCE = "my-source";
protected static final int TIMEOUT_SEC = 10;
@@ -74,8 +76,7 @@ public abstract class BasicBidirectionalTopicOperation extends BasicOperation {
@Mock
protected BidirectionalTopicConfig config;
- @SuppressWarnings("rawtypes")
- private TopicServer topicServer;
+ private TopicServer<Q> topicServer;
/**
* Constructs the object using a default actor and operation name.
@@ -161,8 +162,7 @@ public abstract class BasicBidirectionalTopicOperation extends BasicOperation {
* @param source topic from which the simulator should receive messages
* @return a new topic server/simulator
*/
- @SuppressWarnings("rawtypes")
- protected abstract TopicServer makeServer(TopicSink sink, TopicSource source);
+ protected abstract TopicServer<Q> makeServer(TopicSink sink, TopicSource source);
/**
* Initializes a configuration.
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java
index 4331edb04..02225759c 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java
@@ -42,10 +42,8 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
/**
* Superclass for various HttpOperation tests.
- *
- * @param <Q> request type
*/
-public class BasicHttpOperation<Q> extends BasicOperation {
+public class BasicHttpOperation extends BasicOperation {
protected static final String MY_CLIENT = "my-client";
protected static final String BASE_URI = "http://my-host:6969/base-uri/";
protected static final String PATH = "my-path/";
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java
index afb8f075e..17ddb391a 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java
@@ -48,7 +48,7 @@ public class BasicBidirectionalTopicOperationTest {
@Mock
private BiConsumer<String, StandardCoderObject> listener;
- private BasicBidirectionalTopicOperation oper;
+ private BasicBidirectionalTopicOperation<String> oper;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
@@ -133,7 +133,7 @@ public class BasicBidirectionalTopicOperationTest {
.withMessage("response is not a Map");
}
- private static class MyOperation extends BasicBidirectionalTopicOperation {
+ private static class MyOperation extends BasicBidirectionalTopicOperation<String> {
public MyOperation() {
super();
}
@@ -149,8 +149,7 @@ public class BasicBidirectionalTopicOperationTest {
}
@Override
- @SuppressWarnings("rawtypes")
- protected TopicServer makeServer(TopicSink sink, TopicSource source) {
+ protected TopicServer<String> makeServer(TopicSink sink, TopicSource source) {
return new TopicServer<String>(sink, source, null, String.class) {
@Override
protected String process(String request) {
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java
index c19aa487c..2327fec00 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java
@@ -35,18 +35,18 @@ public class BasicHttpOperationTest {
private static final String ACTOR = "my-actor";
private static final String OPERATION = "my-operation";
- private BasicHttpOperation<String> oper;
+ private BasicHttpOperation oper;
@Before
public void setUp() throws Exception {
- oper = new BasicHttpOperation<>(ACTOR, OPERATION);
+ oper = new BasicHttpOperation(ACTOR, OPERATION);
oper.setUpBasic();
}
@Test
public void testBasicHttpOperation() {
- oper = new BasicHttpOperation<>();
+ oper = new BasicHttpOperation();
assertEquals(BasicOperation.DEFAULT_ACTOR, oper.actorName);
assertEquals(BasicOperation.DEFAULT_OPERATION, oper.operationName);
}
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
index 5eb35e9d0..047378baf 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
@@ -47,13 +47,13 @@ public class BasicOperationTest {
@Before
public void setUp() throws Exception {
- oper = new BasicHttpOperation<>(ACTOR, OPERATION);
+ oper = new BasicHttpOperation(ACTOR, OPERATION);
oper.setUpBasic();
}
@Test
public void testBasicHttpOperation() {
- oper = new BasicHttpOperation<>();
+ oper = new BasicHttpOperation();
assertEquals(BasicHttpOperation.DEFAULT_ACTOR, oper.actorName);
assertEquals(BasicHttpOperation.DEFAULT_OPERATION, oper.operationName);
}
diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java
index d41da1b87..9014e3332 100644
--- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java
+++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java
@@ -29,10 +29,9 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInst
import org.onap.policy.controlloop.actor.test.BasicHttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.simulators.Util;
-import org.onap.policy.vfc.VfcRequest;
import org.onap.policy.vfc.VfcResponse;
-public abstract class BasicVfcOperation extends BasicHttpOperation<VfcRequest> {
+public abstract class BasicVfcOperation extends BasicHttpOperation {
public static final String POLL_PATH = "my-path-get/";
public static final int MAX_POLLS = 3;
public static final int POLL_WAIT_SEC = 20;
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingActorParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingActorParams.java
index 3343c5b3c..8cb3e7c0a 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingActorParams.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingActorParams.java
@@ -24,7 +24,6 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.common.parameters.annotations.Min;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpActorParams;
/**
* Parameters used by Actors that, after issuing an HTTP request, must poll the target
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingParams.java
index 2f33bd217..7244aeec3 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingParams.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingParams.java
@@ -26,7 +26,6 @@ import lombok.experimental.SuperBuilder;
import org.onap.policy.common.parameters.annotations.Min;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
/**
* Parameters used by Operators that, after issuing an HTTP request, must poll the target
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/ListenerManager.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/ListenerManager.java
index b810de393..999aea7be 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/ListenerManager.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/ListenerManager.java
@@ -101,7 +101,6 @@ public class ListenerManager {
* @param listener listener to be executed
*/
protected void runListener(Runnable listener) {
- // TODO do this asynchronously?
Util.runFunction(listener, "pipeline listener {} threw an exception", listener);
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java
index dfd3f8bc6..6a8813cc6 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java
@@ -173,7 +173,8 @@ public class BidirectionalTopicActorTest {
// with invalid actor parameters
params.setOperations(null);
- assertThatThrownBy(() -> prov.makeOperatorParameters(Util.translateToMap(prov.getName(), params)))
+ Map<String, Object> map = Util.translateToMap(prov.getName(), params);
+ assertThatThrownBy(() -> prov.makeOperatorParameters(map))
.isInstanceOf(ParameterValidationRuntimeException.class);
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperatorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperatorTest.java
index ff59176a1..d0dc0a759 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperatorTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperatorTest.java
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.when;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Before;
import org.junit.Test;
@@ -97,7 +98,8 @@ public class BidirectionalTopicOperatorTest {
// invalid parameters
params.setSourceTopic(null);
- assertThatThrownBy(() -> oper.configure(Util.translateToMap(OPERATION, params)))
+ Map<String, Object> map = Util.translateToMap(OPERATION, params);
+ assertThatThrownBy(() -> oper.configure(map))
.isInstanceOf(ParameterValidationRuntimeException.class);
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActorTest.java
index a28b98c81..5407f1fee 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActorTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActorTest.java
@@ -74,7 +74,8 @@ public class HttpActorTest {
// with invalid actor parameters
params.setOperations(null);
- assertThatThrownBy(() -> prov.makeOperatorParameters(Util.translateToMap(prov.getName(), params)))
+ Map<String, Object> map = Util.translateToMap(prov.getName(), params);
+ assertThatThrownBy(() -> prov.makeOperatorParameters(map))
.isInstanceOf(ParameterValidationRuntimeException.class);
}
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java
deleted file mode 100644
index 83923f1bb..000000000
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.aai.util;
-
-public class AaiException extends Exception {
-
- // TODO remove this class
-
- private static final long serialVersionUID = 9220983727706207465L;
-
- public AaiException() {
- super();
- }
-
- public AaiException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
-
- public AaiException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public AaiException(String message) {
- super(message);
- }
-
- public AaiException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
index 326294aab..7a14a854f 100644
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
+++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,8 +26,6 @@ import com.google.gson.GsonBuilder;
public final class Serialization {
- // TODO remove this class
-
public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
private Serialization() {
diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java
deleted file mode 100644
index caee19a87..000000000
--- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.aai.util;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-import org.junit.Test;
-
-public class AaiExceptionTest {
-
- private static final String MESSAGE = "message";
-
- @Test
- public void test() {
- assertNotNull(new AaiException());
- assertNotNull(new AaiException(MESSAGE));
- assertNotNull(new AaiException(MESSAGE, new IOException()));
- assertNotNull(new AaiException(MESSAGE, new IOException(), true, false));
- assertNotNull(new AaiException(new IOException()));
- }
-
-}
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
index 4854e2759..3e84a3df2 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,10 +22,8 @@
package org.onap.policy.appc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.time.Instant;
import java.util.ArrayList;
@@ -85,78 +83,81 @@ public class CommonHeaderTest {
copiedCommonHeader.setSubRequestId(commonHeader.getSubRequestId());
copiedCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- assertTrue(commonHeader.equals(commonHeader));
- assertTrue(commonHeader.equals(copiedCommonHeader));
- assertFalse(commonHeader.equals(null));
- assertFalse(commonHeader.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(commonHeader, commonHeader); // NOSONAR
+ assertEquals(commonHeader, copiedCommonHeader);
+ assertNotEquals(commonHeader, null);
+ assertNotEquals(commonHeader, "Hello"); // NOSONAR
CommonHeader clonedCommonHeader = new CommonHeader(commonHeader);
clonedCommonHeader.setApiVer(commonHeader.getApiVer());
clonedCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- assertTrue(commonHeader.equals(clonedCommonHeader));
+ assertEquals(commonHeader, clonedCommonHeader);
commonHeader.setApiVer(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setApiVer(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setApiVer(KANSAS);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setApiVer(KANSAS);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setFlags(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setFlags(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setFlags(flagSet);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setFlags(flagSet);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setOriginatorId(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setOriginatorId(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setOriginatorId(DOROTHY);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setOriginatorId(DOROTHY);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setRequestId(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setRequestId(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setRequestId(requestId);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setRequestId(requestId);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setRequestTrack(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setRequestTrack(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setRequestTrack(requestTrackSet);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setRequestTrack(requestTrackSet);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setSubRequestId(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setSubRequestId(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setSubRequestId(CAN_I_GO_HOME);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setSubRequestId(CAN_I_GO_HOME);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setTimeStamp(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setTimeStamp(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setTimeStamp(timestamp);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setTimeStamp(timestamp);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
}
}
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
index e6fb868b3..7d804c869 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -72,10 +72,13 @@ public class RequestTest {
copiedRequest.setPayload(request.getPayload());
copiedRequest.setTargetId(request.getTargetId());
- assertEquals(request, request);
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(request, request); // NOSONAR
assertEquals(request, copiedRequest);
- assertNotEquals(null, request);
- assertNotEquals("Hello", request);
+ assertNotEquals(request, null);
+ assertNotEquals(request, "Hello"); // NOSONAR
request.setCommonHeader(null);
assertNotEquals(request, copiedRequest);
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
index 2541f9b0a..ce8b2148d 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,10 +22,8 @@
package org.onap.policy.appc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -57,36 +55,39 @@ public class ResponseStatusTest {
copiedStatus.setDescription(status.getDescription());
copiedStatus.setValue(status.getValue());
- assertTrue(status.equals(status));
- assertTrue(status.equals(copiedStatus));
- assertFalse(status.equals(null));
- assertFalse(status.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(status, status); // NOSONAR
+ assertEquals(status, copiedStatus);
+ assertNotEquals(status, null);
+ assertNotEquals(status, "Hello"); // NOSONAR
status.setCode(-1);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setCode(-1);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setCode(1234);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setCode(1234);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setDescription(null);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setDescription(null);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setDescription(THE_WONDERFUL_LAND_OF_OZ);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setDescription(THE_WONDERFUL_LAND_OF_OZ);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setValue(null);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setValue(null);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setValue(THERE_S_NO_PLACE_LIKE_HOME);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setValue(THERE_S_NO_PLACE_LIKE_HOME);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
}
}
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
index 72c203f98..14e14f0f9 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,10 +22,8 @@
package org.onap.policy.appc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
@@ -69,36 +67,39 @@ public class ResponseTest {
copiedResponse.setStatus(response.getStatus());
copiedResponse.setPayload(response.getPayload());
- assertTrue(response.equals(response));
- assertTrue(response.equals(copiedResponse));
- assertFalse(response.equals(null));
- assertFalse(response.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(response, response); // NOSONAR
+ assertEquals(response, copiedResponse);
+ assertNotEquals(response, null);
+ assertNotEquals(response, "Hello"); // NOSONAR
response.setCommonHeader(null);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setCommonHeader(null);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setCommonHeader(commonHeader);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setCommonHeader(commonHeader);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setStatus(null);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setStatus(null);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setStatus(status);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setStatus(status);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setPayload(new HashMap<String, Object>());
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setPayload(new HashMap<String, Object>());
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setPayload(payload);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setPayload(payload);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
}
}
diff --git a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java
index 84baecdf1..04b584081 100644
--- a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java
+++ b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java
@@ -35,8 +35,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CdsProcessorHandler {
-
private static final Logger LOGGER = LoggerFactory.getLogger(CdsProcessorHandler.class);
+ private static final String LOG_MSG = "[{}|{}|{}|]{}{}";
private CdsProcessorListener listener;
private String url;
@@ -56,8 +56,8 @@ public class CdsProcessorHandler {
final StreamObserver<ExecutionServiceOutput> responseObserver = new StreamObserver<ExecutionServiceOutput>() {
@Override
public void onNext(ExecutionServiceOutput output) {
- LOGGER.info("[{}|{}|{}|]{}{}", EventType.IN, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
- output.toString());
+ LOGGER.info(LOG_MSG, EventType.IN, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
+ output);
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, output.toString());
listener.onMessage(output);
@@ -65,8 +65,8 @@ public class CdsProcessorHandler {
@Override
public void onError(Throwable throwable) {
- LOGGER.info("[{}|{}|{}|]{}{}", EventType.IN, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
- throwable.toString());
+ LOGGER.info(LOG_MSG, EventType.IN, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
+ throwable);
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, throwable.toString());
listener.onError(throwable);
finishLatch.countDown();
@@ -82,8 +82,8 @@ public class CdsProcessorHandler {
final StreamObserver<ExecutionServiceInput> requestObserver = asyncStub.process(responseObserver);
try {
- LOGGER.info("[{}|{}|{}|]{}{}", EventType.OUT, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
- request.toString());
+ LOGGER.info(LOG_MSG, EventType.OUT, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
+ request);
NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, request.toString());
// Send the message to CDS backend for processing
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
index eb1a351d1..54eec71b5 100644
--- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -35,11 +35,14 @@ public class ControlLoopOperationTest {
public void test() {
ControlLoopOperation operation = new ControlLoopOperation();
- assertEquals(operation, operation);
- assertNotEquals(operation, new String());
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(operation, operation); // NOSONAR
+ assertNotEquals(operation, ""); // NOSONAR
assertNotEquals(operation, null);
- assertTrue(operation.hashCode() != 0);
+ assertNotEquals(0, operation.hashCode());
assertTrue(operation.toString().startsWith("ControlLoopOperation"));
assertNotNull(operation);
@@ -68,7 +71,7 @@ public class ControlLoopOperationTest {
operation.setTarget("target");
assertEquals("target", operation.getTarget());
- assertTrue(operation.hashCode() != 0);
+ assertNotEquals(0, operation.hashCode());
ControlLoopOperation operation2 = new ControlLoopOperation(operation);
assertEquals(now, operation2.getEnd());
diff --git a/models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java b/models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java
index f25ab86aa..32827b04b 100644
--- a/models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java
+++ b/models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java
@@ -19,7 +19,7 @@
package org.onap.policy.guard;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import java.util.Date;
@@ -61,9 +61,12 @@ public class OperationsHistoryTest {
int hc = dao.hashCode();
dao.setId(101L);
- assertTrue(hc != dao.hashCode());
+ assertNotEquals(hc, dao.hashCode());
- assertTrue(dao.equals(dao));
- assertFalse(dao.equals(new OperationsHistory()));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(dao, dao); // NOSONAR
+ assertNotEquals(dao, new OperationsHistory());
}
}
diff --git a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java
index 52c0912e3..21df853f4 100644
--- a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java
+++ b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* rest
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,6 +22,7 @@
package org.onap.policy.rest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.lang.annotation.Documented;
@@ -146,55 +147,55 @@ public class RestTest {
Pair<Integer, String> result = mgr.get(getUri, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("GOT: " + EXPECT_STRING, result.getRight());
result = mgr.delete(deleteUri, null, null, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + EXPECT_STRING, result.getRight());
result = mgr.delete(deleteUri, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + EXPECT_STRING, result.getRight());
result = mgr.put(putUri, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.put(putUriBlank, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.post(postUri, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.post(postUriBlank, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.patch(patchUri, null, null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.patch(patchUriBlank, null, null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + RETURN_STRING, result.getRight());
@@ -207,49 +208,49 @@ public class RestTest {
Pair<Integer, String> result = mgr.get(getUri, "", null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("GOT: " + EXPECT_STRING, result.getRight());
result = mgr.delete(deleteUri, "", null, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + EXPECT_STRING, result.getRight());
result = mgr.put(putUri, "", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.put(putUriBlank, "", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.post(postUri, "", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.post(postUriBlank, "", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.patch(patchUri, "", null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.patch(patchUriBlank, "", null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + RETURN_STRING, result.getRight());
@@ -262,49 +263,49 @@ public class RestTest {
Pair<Integer, String> result = mgr.get(getUri, "user", null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("GOT: " + EXPECT_STRING, result.getRight());
result = mgr.delete(deleteUri, "user", null, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + EXPECT_STRING, result.getRight());
result = mgr.put(putUri, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.put(putUriBlank, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.post(postUri, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.post(postUriBlank, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.patch(patchUri, "user", null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.patch(patchUriBlank, "user", null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + RETURN_STRING, result.getRight());
@@ -339,33 +340,33 @@ public class RestTest {
Pair<Integer, String> result = mgr.get(baseUri + "RestTest/GetHello/" + NAME_PARAM, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("GOT: " + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
result = mgr.delete(baseUri + "RestTest/DeleteHello/" + NAME_PARAM, null, null, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
result = mgr.put(baseUri + "RestTest/PutHello/" + NAME_PARAM, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
result = mgr.post(baseUri + "RestTest/PostHello/" + NAME_PARAM, null, null,
null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
result = mgr.patch(baseUri + "RestTest/PatchHello/" + NAME_PARAM, null, null,
null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
index 91ed1e432..fd05affb5 100644
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
+++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.sdc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
@@ -112,8 +111,8 @@ public class ResourceInstanceTest {
public void testEquals() {
ResourceInstance ri1 = new ResourceInstance();
ResourceInstance ri2 = new ResourceInstance(ri1);
- assertTrue(ri1.equals(ri2));
- assertTrue(ri2.equals(ri1));
+ assertEquals(ri1, ri2);
+ assertEquals(ri2, ri1);
ri1.setResourceInstanceName(INSTANCE);
ri1.setResourceName(RESOURCE);
@@ -122,8 +121,8 @@ public class ResourceInstanceTest {
ri1.setResourceVersion(VERSION_000);
ri1.setResourceType(ResourceType.VL);
ri2 = new ResourceInstance(ri1);
- assertTrue(ri1.equals(ri2));
- assertTrue(ri2.equals(ri1));
+ assertEquals(ri1, ri2);
+ assertEquals(ri2, ri1);
}
@Test
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java
index 7b76a9de7..10e26bd9c 100644
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java
+++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.sdc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
@@ -119,14 +118,14 @@ public class ResourceTest {
public void testEquals() {
Resource r1 = new Resource();
Resource r2 = new Resource(r1);
- assertTrue(r1.equals(r2));
- assertTrue(r2.equals(r1));
+ assertEquals(r1, r2);
+ assertEquals(r2, r1);
r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111,
ResourceType.VFC);
r2 = new Resource(r1);
- assertTrue(r1.equals(r2));
- assertTrue(r2.equals(r1));
+ assertEquals(r1, r2);
+ assertEquals(r2, r1);
}
@Test
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
index 336370518..ecd0bb323 100644
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
+++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.sdc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
@@ -125,8 +124,8 @@ public class ServiceInstanceTest {
public void testEquals() {
ServiceInstance si1 = new ServiceInstance();
ServiceInstance si2 = new ServiceInstance(si1);
- assertTrue(si1.equals(si2));
- assertTrue(si2.equals(si1));
+ assertEquals(si1, si2);
+ assertEquals(si2, si1);
si1.setServiceInstanceName(INSTANCE);
si1.setServiceName(SERVICE);
@@ -136,8 +135,8 @@ public class ServiceInstanceTest {
si1.setWidgetModelUUID(UUID.randomUUID());
si1.setWidgetModelVersion(VERSION_333);
si2 = new ServiceInstance(si1);
- assertTrue(si1.equals(si2));
- assertTrue(si2.equals(si1));
+ assertEquals(si1, si2);
+ assertEquals(si2, si1);
}
@Test
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
index d7913624c..1e6c6f917 100644
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
+++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.sdc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
@@ -107,13 +106,13 @@ public class ServiceTest {
public void testEquals() {
Service s1 = new Service();
Service s2 = new Service(s1);
- assertTrue(s1.equals(s2));
- assertTrue(s2.equals(s1));
+ assertEquals(s1, s2);
+ assertEquals(s2, s1);
s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111);
s2 = new Service(s1);
- assertTrue(s1.equals(s2));
- assertTrue(s2.equals(s1));
+ assertEquals(s1, s2);
+ assertEquals(s2, s1);
}
@Test
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
index dfd89c0fe..8c7ee6d53 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,10 +23,8 @@
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.time.Instant;
import java.util.HashMap;
@@ -79,70 +77,73 @@ public class PciCommonHeaderTest {
copiedPciCommonHeader.setSubRequestId(commonHeader.getSubRequestId());
copiedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- assertTrue(commonHeader.equals(commonHeader));
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
- assertFalse(commonHeader.equals(null));
- assertFalse(commonHeader.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(commonHeader, commonHeader); // NOSONAR
+ assertEquals(commonHeader, copiedPciCommonHeader);
+ assertNotEquals(commonHeader, null);
+ assertNotEquals(commonHeader, "Hello"); // NOSONAR
PciCommonHeader clonedPciCommonHeader = new PciCommonHeader(commonHeader);
clonedPciCommonHeader.setApiVer(commonHeader.getApiVer());
clonedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- assertTrue(commonHeader.equals(clonedPciCommonHeader));
+ assertEquals(commonHeader, clonedPciCommonHeader);
commonHeader.setApiVer(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setApiVer(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setApiVer(KANSAS);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setApiVer(KANSAS);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setFlags(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setFlags(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setFlags(flagMap);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setFlags(flagMap);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setRequestTrack(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setRequestTrack(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setRequestTrack(requestMap);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setRequestTrack(requestMap);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setRequestId(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setRequestId(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setRequestId(requestId);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setRequestId(requestId);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setSubRequestId(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setSubRequestId(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setSubRequestId(CAN_I_GO_HOME);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setSubRequestId(CAN_I_GO_HOME);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setTimeStamp(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setTimeStamp(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setTimeStamp(timestamp);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setTimeStamp(timestamp);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
index 0009c2a5c..7719d0966 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,10 +23,8 @@
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -61,36 +59,39 @@ public class PciRequestTest {
copiedPciRequest.setAction(request.getAction());
copiedPciRequest.setPayload(request.getPayload());
- assertTrue(request.equals(request));
- assertTrue(request.equals(copiedPciRequest));
- assertFalse(request.equals(null));
- assertFalse(request.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(request, request); // NOSONAR
+ assertEquals(request, copiedPciRequest);
+ assertNotEquals(request, null);
+ assertNotEquals(request, "Hello"); // NOSONAR
request.setCommonHeader(null);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setCommonHeader(null);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setCommonHeader(commonHeader);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setCommonHeader(commonHeader);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setAction(null);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setAction(null);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setAction(MODIFY);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setAction(MODIFY);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setPayload(null);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setPayload(null);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setPayload(requestPayload);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setPayload(requestPayload);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java
index 897c57d8c..65f362378 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,10 +23,8 @@
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -50,18 +49,21 @@ public class PciRequestWrapperTest {
PciRequestWrapper copiedPciRequestWrapper = new PciRequestWrapper();
copiedPciRequestWrapper.setBody(requestWrapper.getBody());
- assertTrue(requestWrapper.equals(requestWrapper));
- assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
- assertFalse(requestWrapper.equals(null));
- assertFalse(requestWrapper.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(requestWrapper, requestWrapper); // NOSONAR
+ assertEquals(requestWrapper, copiedPciRequestWrapper);
+ assertNotEquals(requestWrapper, null);
+ assertNotEquals(requestWrapper, "Hello"); // NOSONAR
requestWrapper.setBody(null);
- assertFalse(requestWrapper.equals(copiedPciRequestWrapper));
+ assertNotEquals(requestWrapper, copiedPciRequestWrapper);
copiedPciRequestWrapper.setBody(null);
- assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
+ assertEquals(requestWrapper, copiedPciRequestWrapper);
requestWrapper.setBody(request);
- assertFalse(requestWrapper.equals(copiedPciRequestWrapper));
+ assertNotEquals(requestWrapper, copiedPciRequestWrapper);
copiedPciRequestWrapper.setBody(request);
- assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
+ assertEquals(requestWrapper, copiedPciRequestWrapper);
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
index 6e990ea12..bd96e8e4c 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,10 +22,11 @@
package org.onap.policy.sdnr;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -40,13 +41,13 @@ public class PciResponseTest {
@Test
public void testHashCode() {
PciResponse response = new PciResponse();
- assertTrue(response.hashCode() != 0);
+ assertNotEquals(0, response.hashCode());
response.setCommonHeader(new PciCommonHeader());
- assertTrue(response.hashCode() != 0);
+ assertNotEquals(0, response.hashCode());
response.setPayload(responsePayload);
- assertTrue(response.hashCode() != 0);
+ assertNotEquals(0, response.hashCode());
response.setStatus(null);
- assertTrue(response.hashCode() != 0);
+ assertNotEquals(0, response.hashCode());
}
@Test
@@ -66,43 +67,43 @@ public class PciResponseTest {
@Test
public void testEqualsObject() {
PciResponse response = new PciResponse();
- assertTrue(response.equals(response));
- assertFalse(response.equals(null));
- assertFalse(response.equals(new Object()));
+ assertEquals(response, response);
+ assertNotEquals(response, null);
+ assertNotEquals(response, new Object());
PciResponse response2 = new PciResponse();
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setCommonHeader(new PciCommonHeader());
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setCommonHeader(response.getCommonHeader());
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setPayload(responsePayload);
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setPayload(response.getPayload());
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setCommonHeader(null);
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setCommonHeader(null);
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setPayload(null);
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setPayload(response.getPayload());
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setStatus(null);
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setStatus(response.getStatus());
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
Status stat = new Status();
stat.setCode(5);
response.setStatus(stat);
response2.setStatus(new Status());
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
}
@Test
@@ -113,7 +114,7 @@ public class PciResponseTest {
PciResponse response = new PciResponse(request);
- assertTrue(response.getCommonHeader().equals(request.getCommonHeader()));
+ assertEquals(response.getCommonHeader(), request.getCommonHeader());
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java
index 166c3aa61..cb12083f3 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,10 +23,8 @@
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -50,18 +49,21 @@ public class PciResponseWrapperTest {
PciResponseWrapper copiedPciResponseWrapper = new PciResponseWrapper();
copiedPciResponseWrapper.setBody(responseWrapper.getBody());
- assertTrue(responseWrapper.equals(responseWrapper));
- //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
- assertFalse(responseWrapper.equals(null));
- assertFalse(responseWrapper.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(responseWrapper, responseWrapper); // NOSONAR
+ //assertEquals(responseWrapper, copiedPciResponseWrapper);
+ assertNotEquals(responseWrapper, null);
+ assertNotEquals(responseWrapper, "Hello"); // NOSONAR
responseWrapper.setBody(null);
- assertFalse(responseWrapper.equals(copiedPciResponseWrapper));
+ assertNotEquals(responseWrapper, copiedPciResponseWrapper);
copiedPciResponseWrapper.setBody(null);
- //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
+ //assertEquals(responseWrapper, copiedPciResponseWrapper);
responseWrapper.setBody(response);
- //assertFalse(responseWrapper.equals(copiedPciResponseWrapper));
+ //assertNotEquals(responseWrapper, copiedPciResponseWrapper);
copiedPciResponseWrapper.setBody(response);
- //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
+ //assertEquals(responseWrapper, copiedPciResponseWrapper);
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
index 08ac56b85..2f6c7f8ba 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,10 +23,8 @@
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -52,27 +50,30 @@ public class PciStatusTest {
copiedStatus.setCode(status.getCode());
copiedStatus.setValue(status.getValue());
- assertTrue(status.equals(status));
- assertTrue(status.equals(copiedStatus));
- assertFalse(status.equals(null));
- assertFalse(status.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(status, status); // NOSONAR
+ assertEquals(status, copiedStatus);
+ assertNotEquals(status, null);
+ assertNotEquals(status, "Hello"); // NOSONAR
status.setCode(-1);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setCode(-1);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setCode(1234);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setCode(1234);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setValue(null);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setValue(null);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setValue(THE_WONDERFUL_LAND_OF_OZ);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setValue(THE_WONDERFUL_LAND_OF_OZ);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
index f05f50e67..d25be8340 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,10 +23,8 @@
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -70,54 +68,54 @@ public class PciWrapperTest {
copiedPciWrapper.setCorrelationId(wrapper.getCorrelationId());
copiedPciWrapper.setType(wrapper.getType());
- assertTrue(wrapper.equals(wrapper));
- assertTrue(wrapper.equals(copiedPciWrapper));
- assertFalse(wrapper.equals(null));
- assertFalse(wrapper.equals("Hello"));
+ assertEquals(wrapper, wrapper);
+ assertEquals(wrapper, copiedPciWrapper);
+ assertNotEquals(wrapper, null);
+ assertNotEquals(wrapper, "Hello");
wrapper.setVersion(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setVersion(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setVersion(VERSION_19);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setVersion(VERSION_19);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setCambriaPartition(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setCambriaPartition(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setCambriaPartition(THE_EMERALD_CITY);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setCambriaPartition(THE_EMERALD_CITY);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setRpcName(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setRpcName(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setRpcName(TORNADO);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setRpcName(TORNADO);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setCorrelationId(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setCorrelationId(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setCorrelationId(YELLOW_BRICK_ROAD);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setCorrelationId(YELLOW_BRICK_ROAD);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setType(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setType(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setType(MUNCHKIN);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setType(MUNCHKIN);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
}
}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java
index 8d0fdb24c..4aa2db37c 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java
@@ -3,7 +3,7 @@
* so
* ================================================================================
*
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import java.time.LocalDateTime;
import org.junit.Test;
@@ -34,13 +34,13 @@ public class SoAsyncRequestStatusTest {
public void testConstructor() {
SoAsyncRequestStatus obj = new SoAsyncRequestStatus();
- assertTrue(obj.getCorrelator() == null);
- assertTrue(obj.getFinishTime() == null);
- assertTrue(obj.getInstanceReferences() == null);
- assertTrue(obj.getRequestId() == null);
- assertTrue(obj.getRequestScope() == null);
- assertTrue(obj.getRequestStatus() == null);
- assertTrue(obj.getStartTime() == null);
+ assertNull(obj.getCorrelator());
+ assertNull(obj.getFinishTime());
+ assertNull(obj.getInstanceReferences());
+ assertNull(obj.getRequestId());
+ assertNull(obj.getRequestScope());
+ assertNull(obj.getRequestStatus());
+ assertNull(obj.getStartTime());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java
index 58b3943e4..59626f45d 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java
@@ -3,7 +3,7 @@
* so
* ================================================================================
*
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,8 +33,8 @@ public class SoCloudConfigurationTest {
public void testConstructor() {
SoCloudConfiguration obj = new SoCloudConfiguration();
- assertTrue(obj.getLcpCloudRegionId() == null);
- assertTrue(obj.getTenantId() == null);
+ assertNull(obj.getLcpCloudRegionId());
+ assertNull(obj.getTenantId());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java
index 0b0aa5f03..b8e01c6c1 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +22,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,8 +32,8 @@ public class SoInstanceReferencesTest {
public void testConstructor() {
SoInstanceReferences obj = new SoInstanceReferences();
- assertTrue(obj.getInstanceId() == null);
- assertTrue(obj.getRequestId() == null);
+ assertNull(obj.getInstanceId());
+ assertNull(obj.getRequestId());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java
index 60b86bf01..a9f5baaba 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java
@@ -3,7 +3,7 @@
* so
* ================================================================================
*
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,13 +33,13 @@ public class SoModelInfoTest {
public void testConstructor() {
SoModelInfo obj = new SoModelInfo();
- assertTrue(obj.getModelCustomizationId() == null);
- assertTrue(obj.getModelCustomizationName() == null);
- assertTrue(obj.getModelInvariantId() == null);
- assertTrue(obj.getModelName() == null);
- assertTrue(obj.getModelType() == null);
- assertTrue(obj.getModelVersion() == null);
- assertTrue(obj.getModelVersionId() == null);
+ assertNull(obj.getModelCustomizationId());
+ assertNull(obj.getModelCustomizationName());
+ assertNull(obj.getModelInvariantId());
+ assertNull(obj.getModelName());
+ assertNull(obj.getModelType());
+ assertNull(obj.getModelVersion());
+ assertNull(obj.getModelVersionId());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java
index 3511d1349..e6fc8fee9 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -32,8 +32,8 @@ public class SoPolicyExceptionHolderTest {
public void testConstructor() {
SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder();
- assertTrue(obj.getMessageId() == null);
- assertTrue(obj.getText() == null);
+ assertNull(obj.getMessageId());
+ assertNull(obj.getText());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java
index bad45ebc8..b6c2e0671 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java
@@ -3,7 +3,7 @@
* so
* ================================================================================
*
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,7 +33,7 @@ public class SoRelatedInstanceListElementTest {
public void testConstructor() {
SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement();
- assertTrue(obj.getRelatedInstance() == null);
+ assertNull(obj.getRelatedInstance());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java
index 72afdda3f..f215d0184 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -32,9 +32,9 @@ public class SoRelatedInstanceTest {
public void testConstructor() {
SoRelatedInstance obj = new SoRelatedInstance();
- assertTrue(obj.getInstanceId() == null);
- assertTrue(obj.getInstanceName() == null);
- assertTrue(obj.getModelInfo() == null);
+ assertNull(obj.getInstanceId());
+ assertNull(obj.getInstanceName());
+ assertNull(obj.getModelInfo());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
index 25a89e31e..2fea0f868 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,6 +27,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
@@ -39,13 +40,13 @@ public class SoRequestDetailsTest {
public void testConstructor() {
SoRequestDetails obj = new SoRequestDetails();
- assertTrue(obj.getCloudConfiguration() == null);
- assertTrue(obj.getModelInfo() == null);
- assertTrue(obj.getRequestInfo() == null);
- assertTrue(obj.getRequestParameters() == null);
- assertTrue(obj.getSubscriberInfo() == null);
+ assertNull(obj.getCloudConfiguration());
+ assertNull(obj.getModelInfo());
+ assertNull(obj.getRequestInfo());
+ assertNull(obj.getRequestParameters());
+ assertNull(obj.getSubscriberInfo());
- assertTrue(obj.getRelatedInstanceList() != null);
+ assertNotNull(obj.getRelatedInstanceList());
assertEquals(0, obj.getRelatedInstanceList().size());
}
@@ -73,7 +74,7 @@ public class SoRequestDetailsTest {
obj.setSubscriberInfo(subscriberInfo);
assertEquals(subscriberInfo, obj.getSubscriberInfo());
}
-
+
@Test
public void testSoMRequestDetailsMethods() {
SoRequestDetails details = new SoRequestDetails();
@@ -118,7 +119,7 @@ public class SoRequestDetailsTest {
assertTrue(details.equals(copiedDetails));
assertFalse(details.equals(null));
assertFalse(details.equals("Hello"));
-
+
details.setCloudConfiguration(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setCloudConfiguration(null);
@@ -136,7 +137,7 @@ public class SoRequestDetailsTest {
assertFalse(details.equals(copiedDetails));
copiedDetails.setModelInfo(modelInfo);
assertTrue(details.equals(copiedDetails));
-
+
details.setRequestInfo(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestInfo(null);
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java
index e0b819343..f70e598f2 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
@@ -23,7 +23,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,8 +33,8 @@ public class SoRequestErrorTest {
public void testConstructor() {
SoRequestError obj = new SoRequestError();
- assertTrue(obj.getPolicyException() == null);
- assertTrue(obj.getServiceException() == null);
+ assertNull(obj.getPolicyException());
+ assertNull(obj.getServiceException());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java
index 92638f906..563e28d31 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +22,8 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,8 +33,8 @@ public class SoRequestParametersTest {
public void testConstructor() {
SoRequestParameters obj = new SoRequestParameters();
- assertTrue(obj.getSubscriptionServiceType() == null);
- assertTrue(obj.getUserParams() != null);
+ assertNull(obj.getSubscriptionServiceType());
+ assertNotNull(obj.getUserParams());
assertEquals(0, obj.getUserParams().size());
}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java
index 42481996a..83172dee2 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +22,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,8 +32,8 @@ public class SoRequestReferencesTest {
public void testConstructor() {
SoRequestReferences obj = new SoRequestReferences();
- assertTrue(obj.getInstanceId() == null);
- assertTrue(obj.getRequestId() == null);
+ assertNull(obj.getInstanceId());
+ assertNull(obj.getRequestId());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java
index b83cb00dc..2b0c572ce 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +23,7 @@ package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -35,8 +35,8 @@ public class SoRequestStatusTest {
SoRequestStatus obj = new SoRequestStatus();
assertEquals(0, obj.getPercentProgress());
- assertTrue(obj.getRequestState() == null);
- assertTrue(obj.getTimestamp() == null);
+ assertNull(obj.getRequestState());
+ assertNull(obj.getTimestamp());
assertFalse(obj.isWasRolledBack());
}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java
index 4dba63511..959016445 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +22,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import java.time.LocalDateTime;
import java.util.UUID;
@@ -35,13 +34,13 @@ public class SoRequestTest {
public void testConstructor() {
SoRequest obj = new SoRequest();
- assertTrue(obj.getFinishTime() == null);
- assertTrue(obj.getRequestDetails() == null);
- assertTrue(obj.getRequestId() == null);
- assertTrue(obj.getRequestScope() == null);
- assertTrue(obj.getRequestStatus() == null);
- assertTrue(obj.getRequestType() == null);
- assertTrue(obj.getStartTime() == null);
+ assertNull(obj.getFinishTime());
+ assertNull(obj.getRequestDetails());
+ assertNull(obj.getRequestId());
+ assertNull(obj.getRequestScope());
+ assertNull(obj.getRequestStatus());
+ assertNull(obj.getRequestType());
+ assertNull(obj.getStartTime());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java
index eb1b0ef6d..c75aa9ec9 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +22,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -34,9 +33,9 @@ public class SoResponseTest {
SoResponse obj = new SoResponse();
assertEquals(0, obj.getHttpResponseCode());
- assertTrue(obj.getRequest() == null);
- assertTrue(obj.getRequestError() == null);
- assertTrue(obj.getRequestReferences() == null);
+ assertNull(obj.getRequest());
+ assertNull(obj.getRequestError());
+ assertNull(obj.getRequestReferences());
}
@Test
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
index 635e7dd16..e508c44f8 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -73,12 +72,16 @@ public class SoResponseWrapperTest {
SoResponseWrapper identicalResponseWrapper = new SoResponseWrapper(response, requestId);
- assertEquals(responseWrapper, responseWrapper);
+ /*
+ * Disabling sonar because we are purposely checking various branches of the
+ * equals() method.
+ */
+ assertEquals(responseWrapper, responseWrapper); // NOSONAR
assertEquals(responseWrapper, identicalResponseWrapper);
assertNotEquals(null, responseWrapper);
- assertNotEquals("Hello", responseWrapper);
- assertFalse(responseWrapper.equals(null));
- assertFalse(responseWrapper.equals("AString"));
+ assertNotEquals("Hello", responseWrapper); // NOSONAR
+ assertNotEquals(responseWrapper, null);
+ assertNotEquals(responseWrapper, "AString"); // NOSONAR
assertEquals(new SoResponseWrapper(null, null), new SoResponseWrapper(null, null));
assertNotEquals(new SoResponseWrapper(null, null), identicalResponseWrapper);
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java
index b5f31e595..981db650d 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +22,8 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,9 +33,9 @@ public class SoServiceExceptionHolderTest {
public void testConstructor() {
SoServiceExceptionHolder obj = new SoServiceExceptionHolder();
- assertTrue(obj.getMessageId() == null);
- assertTrue(obj.getText() == null);
- assertTrue(obj.getVariables() != null);
+ assertNull(obj.getMessageId());
+ assertNull(obj.getText());
+ assertNotNull(obj.getVariables());
assertEquals(0, obj.getVariables().size());
}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java
index 4d5bc7504..56278b0a9 100644
--- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java
@@ -2,8 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +22,7 @@
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -33,9 +32,9 @@ public class SoSubscriberInfoTest {
public void testConstructor() {
SoSubscriberInfo obj = new SoSubscriberInfo();
- assertTrue(obj.getGlobalSubscriberId() == null);
- assertTrue(obj.getSubscriberCommonSiteId() == null);
- assertTrue(obj.getSubscriberName() == null);
+ assertNull(obj.getGlobalSubscriberId());
+ assertNull(obj.getSubscriberCommonSiteId());
+ assertNull(obj.getSubscriberName());
}
@Test
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
index 1d60af0e1..e8d2f7d32 100644
--- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
+++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,6 +58,6 @@ public class AaiSimulatorTest {
final AaiCqResponse response = new AaiManager(new RestManager()).getCustomQueryResponse("http://localhost:6666",
"testUser", "testPass", UUID.randomUUID(), "f953c499-4b1e-426b-8c6d-e9e9f1fc730f");
assertNotNull(response);
- assertEquals(response.getVserver().getVserverId(), "f953c499-4b1e-426b-8c6d-e9e9f1fc730f");
+ assertEquals("f953c499-4b1e-426b-8c6d-e9e9f1fc730f", response.getVserver().getVserverId());
}
}
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
index d68e9dc5d..dc48e75a1 100644
--- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
+++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,8 +21,8 @@
package org.onap.policy.simulators;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.HashMap;
@@ -60,7 +60,7 @@ public class VfcSimulatorTest {
new RestManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password",
new HashMap<String, String>(), "application/json", "Some Request Here");
assertNotNull(httpDetails);
- assertTrue(httpDetails.getLeft() == 202);
+ assertEquals(202, httpDetails.getLeft().intValue());
final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.getRight(), VfcResponse.class);
assertNotNull(response);
}
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java
index a74029e10..e3438acb9 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -73,7 +74,7 @@ public class DeploymentGroupTest {
assertEquals(hash, group.hashCode());
group.setName("B");
- assertTrue(hash != group.hashCode());
+ assertNotEquals(hash, group.hashCode());
}
@Test
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java
index 4f11079c2..0ede98064 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +24,7 @@ package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -94,7 +95,7 @@ public class PdpGroupTest {
assertEquals(hash, group.hashCode());
group.setDescription("B");
- assertTrue(hash != group.hashCode());
+ assertNotEquals(hash, group.hashCode());
}
@Test
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
index 2dfcb30fe..c37979f81 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,7 @@ package org.onap.policy.models.pdp.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotSame;
import static org.onap.policy.models.pdp.concepts.PdpMessageUtils.removeVariableFields;
import java.util.Arrays;
@@ -69,7 +69,7 @@ public class PdpUpdateTest {
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
// ensure list and items are not the same object
- assertTrue(other.getPolicies() != policies);
- assertTrue(other.getPolicies().get(0) != policies.get(0));
+ assertNotSame(other.getPolicies(), policies);
+ assertNotSame(other.getPolicies().get(0), policies.get(0));
}
}
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
index 1daadcf68..a013addab 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -173,7 +173,7 @@ public class JpaPdpGroupTest {
assertEquals(0, testJpaPdpGroup.compareTo(otherJpaPdpGroup));
assertEquals(-1, testJpaPdpGroup.compareTo(null));
assertEquals(0, testJpaPdpGroup.compareTo(testJpaPdpGroup));
- assertFalse(testJpaPdpGroup.compareTo(new DummyJpaPdpSubgroupChild()) == 0);
+ assertNotEquals(0, testJpaPdpGroup.compareTo(new DummyJpaPdpSubgroupChild()));
testJpaPdpGroup.getKey().setName("OtherName");
assertEquals(-1, testJpaPdpGroup.compareTo(otherJpaPdpGroup));
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
index 7f8752d56..cb27151f8 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -219,7 +219,7 @@ public class JpaPdpSubGroupTest {
assertEquals(0, testJpaPdpSubGroup.compareTo(otherJpaPdpSubGroup));
assertEquals(-1, testJpaPdpSubGroup.compareTo(null));
assertEquals(0, testJpaPdpSubGroup.compareTo(testJpaPdpSubGroup));
- assertFalse(testJpaPdpSubGroup.compareTo(new DummyJpaPdpSubgroupChild()) == 0);
+ assertNotEquals(0, testJpaPdpSubGroup.compareTo(new DummyJpaPdpSubgroupChild()));
testJpaPdpSubGroup.getKey().setParentKeyName("Parent1");
assertEquals(1, testJpaPdpSubGroup.compareTo(otherJpaPdpSubGroup));
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
index e17b8a8b4..74a3c9e31 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.pdp.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -161,7 +162,7 @@ public class JpaPdpTest {
assertEquals(0, testJpaPdp.compareTo(otherJpaPdp));
assertEquals(-1, testJpaPdp.compareTo(null));
assertEquals(0, testJpaPdp.compareTo(testJpaPdp));
- assertFalse(testJpaPdp.compareTo(new DummyJpaPdpChild()) == 0);
+ assertNotEquals(0, testJpaPdp.compareTo(new DummyJpaPdpChild()));
testJpaPdp.getKey().setParentLocalName("ParentLocal1");
assertEquals(1, testJpaPdp.compareTo(otherJpaPdp));
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java
index 7f4e4b116..baa13a1bb 100644
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java
+++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.sim.dmaap.startstop;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.After;
@@ -75,7 +76,7 @@ public class MainTest {
public void testMain_NoArguments() {
final String[] NormalParameters = {};
main = new Main(NormalParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
@Test
@@ -83,7 +84,7 @@ public class MainTest {
// note: this is missing the "-c" argument, thus the ARGUMENTS are invalid
final String[] NormalParameters = {"parameters/NormalParameters.json"};
main = new Main(NormalParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
@Test
@@ -96,6 +97,6 @@ public class MainTest {
public void testMain_InvalidParameters() {
final String[] NormalParameters = {"-c", "parameters/InvalidParameters.json"};
main = new Main(NormalParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
}
diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java
index de0181b70..0f82e6608 100644
--- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java
+++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java
@@ -24,6 +24,7 @@ package org.onap.policy.models.sim.pdp;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.After;
@@ -81,14 +82,14 @@ public class TestPdpSimulatorMain {
public void testPdpSimulator_NoArguments() {
final String[] pdpSimulatorConfigParameters = {};
pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters);
- assertTrue(pdpSimulator.getParameters() == null);
+ assertNull(pdpSimulator.getParameters());
}
@Test
public void testPdpSimulator_InvalidArguments() {
final String[] pdpSimulatorConfigParameters = { "src/test/resourcesPdpSimulatorConfigParameters.json" };
pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters);
- assertTrue(pdpSimulator.getParameters() == null);
+ assertNull(pdpSimulator.getParameters());
}
@Test
@@ -102,6 +103,6 @@ public class TestPdpSimulatorMain {
final String[] pdpSimulatorConfigParameters =
{ "-c", "src/test/resources/PdpSimulatorConfigParameters_InvalidName.json" };
pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters);
- assertTrue(pdpSimulator.getParameters() == null);
+ assertNull(pdpSimulator.getParameters());
}
}