Fix some sonars in policy-models 25/110425/2
authorJim Hahn <jrh3@att.com>
Tue, 21 Jul 2020 13:55:38 +0000 (09:55 -0400)
committerJim Hahn <jrh3@att.com>
Tue, 21 Jul 2020 20:25:53 +0000 (16:25 -0400)
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>
74 files changed:
models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java
models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java
models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java
models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java
models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java
models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java
models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java
models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java
models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java
models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingActorParams.java
models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpPollingParams.java
models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/ListenerManager.java
models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java
models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperatorTest.java
models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActorTest.java
models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java [deleted file]
models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java [deleted file]
models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/CdsProcessorHandler.java
models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java
models-interactions/model-impl/guard/src/test/java/org/onap/policy/guard/OperationsHistoryTest.java
models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java
models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java
models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java
models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java
models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java
models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java
models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java
models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorMain.java

index c6e273d..173eb29 100644 (file)
@@ -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";
index 673b651..df0dbff 100644 (file)
@@ -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";
index d197789..042b64f 100644 (file)
@@ -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";
 
index 1e9a1d9..be8a264 100644 (file)
@@ -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";
 
index ae38cca..ca8233a 100644 (file)
@@ -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() {
index 2715bfe..1f481ae 100644 (file)
@@ -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.
index 546a38d..1a8c603 100644 (file)
@@ -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);
     }
 
index fcfb6b8..6059cb5 100644 (file)
@@ -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);
     }
 
index da0ee95..6fe8cea 100644 (file)
@@ -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;
index 5cc0956..8c45bc3 100644 (file)
@@ -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.
      */
index 15f919b..385052f 100644 (file)
@@ -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);
     }
 
index c67243f..dc8b0d6 100644 (file)
@@ -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
 
index c8afab4..3541333 100644 (file)
@@ -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";
index c8b6967..fc45459 100644 (file)
@@ -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.
index 4331edb..0222575 100644 (file)
@@ -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/";
index afb8f07..17ddb39 100644 (file)
@@ -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) {
index c19aa48..2327fec 100644 (file)
@@ -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);
     }
index 5eb35e9..047378b 100644 (file)
@@ -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);
     }
index d41da1b..9014e33 100644 (file)
@@ -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;
index 2f33bd2..7244aee 100644 (file)
@@ -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
index dfd3f8b..6a8813c 100644 (file)
@@ -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);
     }
 
index ff59176..d0dc0a7 100644 (file)
@@ -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);
     }
 
index a28b98c..5407f1f 100644 (file)
@@ -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 (file)
index 83923f1..0000000
+++ /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);
-    }
-
-}
index 326294a..7a14a85 100644 (file)
@@ -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 (file)
index caee19a..0000000
+++ /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()));
-    }
-
-}
index 4854e27..3e84a3d 100644 (file)
@@ -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");
 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);
     }
 }
index e6fb868..7d804c8 100644 (file)
@@ -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);
index 2541f9b..ce8b214 100644 (file)
@@ -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");
 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);
     }
 }
index 72c203f..14e14f0 100644 (file)
@@ -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");
 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);
     }
 }
index 84baecd..04b5840 100644 (file)
@@ -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
index eb1a351..54eec71 100644 (file)
@@ -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());
index f25ab86..32827b0 100644 (file)
@@ -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());
     }
 }
index 52c0912..21df853 100644 (file)
@@ -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());
 
index 91ed1e4..fd05aff 100644 (file)
@@ -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
index 7b76a9d..10e26bd 100644 (file)
@@ -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
index 3363705..ecd0bb3 100644 (file)
@@ -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
index d791362..1e6c6f9 100644 (file)
@@ -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
index dfd89c0..8c7ee6d 100644 (file)
@@ -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.
 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);
     }
 }
index 0009c2a..7719d09 100644 (file)
@@ -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.
 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);
     }
 }
index 897c57d..65f3623 100644 (file)
@@ -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.
 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);
     }
 }
index 6e990ea..bd96e8e 100644 (file)
@@ -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.
 
 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());
     }
 
 }
index 166c3aa..cb12083 100644 (file)
@@ -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.
 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);
     }
 }
index 08ac56b..2f6c7f8 100644 (file)
@@ -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.
 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);
     }
 }
index f05f50e..d25be83 100644 (file)
@@ -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.
 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);
     }
 }
index 8d0fdb2..4aa2db3 100644 (file)
@@ -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
index 58b3943..59626f4 100644 (file)
@@ -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
index 0b0aa5f..b8e01c6 100644 (file)
@@ -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
index 60b86bf..a9f5baa 100644 (file)
@@ -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
index 3511d13..e6fc8fe 100644 (file)
@@ -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
index bad45eb..b6c2e06 100644 (file)
@@ -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
index 72afdda..f215d01 100644 (file)
@@ -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
index 25a89e3..2fea0f8 100644 (file)
@@ -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);
index e0b8193..f70e598 100644 (file)
@@ -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
index 92638f9..563e28d 100644 (file)
@@ -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());
     }
 
index 4248199..83172de 100644 (file)
@@ -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
index b83cb00..2b0c572 100644 (file)
@@ -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());
     }
 
index 4dba635..9590164 100644 (file)
@@ -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
index eb1b0ef..c75aa9e 100644 (file)
@@ -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
index 635e7dd..e508c44 100644 (file)
@@ -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);
index b5f31e5..981db65 100644 (file)
@@ -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());
     }
 
index 4d5bc75..56278b0 100644 (file)
@@ -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
index 1d60af0..e8d2f7d 100644 (file)
@@ -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());
     }
 }
index d68e9dc..dc48e75 100644 (file)
@@ -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);
     }
index a74029e..e3438ac 100644 (file)
@@ -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
index 4f11079..0ede980 100644 (file)
@@ -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
index 2dfcb30..c37979f 100644 (file)
@@ -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));
     }
 }
index 1daadcf..a013add 100644 (file)
@@ -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));
index 7f8752d..cb27151 100644 (file)
@@ -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));
index e17b8a8..74a3c9e 100644 (file)
@@ -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));
index 7f4e4b1..baa13a1 100644 (file)
@@ -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());
     }
 }
index de0181b..0f82e66 100644 (file)
@@ -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());
     }
 }