SONAR assertion cleanup 23/111023/2
authorwaynedunican <wayne.dunican@est.tech>
Fri, 7 Aug 2020 08:51:52 +0000 (09:51 +0100)
committerwaynedunican <wayne.dunican@est.tech>
Mon, 10 Aug 2020 10:34:03 +0000 (11:34 +0100)
Replaced assertions to not have the same actual and expected expression
in apex-pdp

Issue-ID: POLICY-2761
Change-Id: I2bf45a3cc4411bd39f93f9d0b8c8e56dd318281e
Signed-off-by: waynedunican <wayne.dunican@est.tech>
27 files changed:
client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java
core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.java
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java
model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java
model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUseTest.java
model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKeyTest.java
model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java
model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java
model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java
model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java
model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineModelTest.java
model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java
model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventModelTest.java
model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java
model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/FieldTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java

index 469f095..e8e7e92 100644 (file)
@@ -237,8 +237,8 @@ public class RestResourceTest {
         assertTrue(slidingWindowList0.add("Howdy"));
 
         assertNotNull(slidingWindowList0);
-        assertEquals(slidingWindowList0, slidingWindowList0);
-
+        // disabling sonar because this code tests the equals() method
+        assertEquals(slidingWindowList0, slidingWindowList0); // NOSONAR
         ApexMonitoringRestResource.SlidingWindowList<String> slidingWindowList1 = restResource.new SlidingWindowList<>(
                         2);
         ApexMonitoringRestResource.SlidingWindowList<String> slidingWindowList2 = restResource.new SlidingWindowList<>(
index 6ac0d2e..fa04f19 100644 (file)
@@ -148,8 +148,8 @@ public class EnEventTest {
         assertNull(event.get("MyField"));
 
         assertNotEquals(0, event.hashCode());
-
-        assertEquals(event, event);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(event, event); // NOSONAR
         assertNotNull(event);
         Map<String, Object> hashMap = new HashMap<>();
         assertNotEquals(event, hashMap);
index 9258845..db13069 100644 (file)
@@ -64,7 +64,8 @@ public class SupportMessageTester {
         dummyMessage = new DummyMessage(null, null, null);
         assertEquals(0, dummyMessage.hashCode());
 
-        assertEquals(dummyMessage, dummyMessage);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(dummyMessage, dummyMessage); // NOSONAR
         assertNotNull(dummyMessage);
         assertNotEquals(dummyMessage, new StartEngine(new AxArtifactKey()));
 
index 87fe44a..6e588db 100644 (file)
@@ -71,10 +71,10 @@ public class EngineServiceInfoResponseTest {
         response.setEngineKeyArray(engineKeyArrayList);
         assertNotEquals(0, response.hashCode());
         response.setEngineKeyArray(null);
-
-        assertEquals(response, response);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(response, response); // NOSONAR
         assertNotNull(response);
-        assertNotEquals(response, (Object) new StartEngine(new AxArtifactKey()));
+        assertNotEquals(response, new StartEngine(new AxArtifactKey()));
 
         response = new EngineServiceInfoResponse(null, false, null);
         EngineServiceInfoResponse otherResponse = new EngineServiceInfoResponse(null, false, null);
index b28993a..35fe5bb 100644 (file)
@@ -53,7 +53,7 @@ public class ResponseTest {
         final AxArtifactKey responseKey = new AxArtifactKey("ResponseTest", "0.0.1");
         final AxArtifactKey responseToKey = new AxArtifactKey("ResponseTestTo", "0.0.1");
         UpdateModel responseTo = new UpdateModel(responseToKey);
-        
+
         Response message = new Response(responseKey, false, responseTo);
         logger.debug(message.toString());
         assertTrue(message.toString().contains("ResponseTest"));
@@ -73,8 +73,8 @@ public class ResponseTest {
         assertNotEquals(0, message.hashCode());
         message = new Response(responseKey, true, new UpdateModel(null));
         assertNotEquals(0, message.hashCode());
-
-        assertEquals(message, message);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(message, message); // NOSONAR
         assertNotNull(message);
         assertNotEquals(message, new StartEngine(new AxArtifactKey()));
 
index 0839a43..13d37a8 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -68,8 +69,8 @@ public class UpdateModelTest {
         assertNotEquals(0, message.hashCode());
         message = new UpdateModel(null, null, false, true);
         assertNotEquals(0, message.hashCode());
-
-        assertEquals(message, message);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(message, message); // NOSONAR
         assertNotNull(message);
         assertNotEquals(message, new StartEngine(new AxArtifactKey()));
 
index 991d020..b22d45c 100644 (file)
@@ -58,11 +58,11 @@ public class AxKeyInfoTest {
                         .startsWith("AxKeyInfo:(artifactId=AxArtifactKey:(name=key,version=0.0.1),uuid="));
 
         assertNotEquals(0, testKeyInfo.hashCode());
-
-        assertEquals(testKeyInfo, testKeyInfo);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(testKeyInfo, testKeyInfo); // NOSONAR
         assertEquals(testKeyInfo, clonedReferenceKey);
         assertNotNull(testKeyInfo);
-        assertNotEquals(testKeyInfo, (Object) new AxArtifactKey());
+        assertNotEquals(testKeyInfo, new AxArtifactKey());
         assertNotEquals(testKeyInfo, new AxKeyInfo(new AxArtifactKey()));
         assertNotEquals(testKeyInfo, new AxKeyInfo(key, UUID.randomUUID(), "Some Description"));
         assertNotEquals(testKeyInfo, new AxKeyInfo(key, uuid, "Some Description"));
index fbbc4a7..60c848d 100644 (file)
@@ -109,8 +109,9 @@ public class AxKeyTest {
         assertEquals(353602977, someKey0.compareTo(new AxReferenceKey()));
 
         assertNotNull(someKey0);
-        assertEquals(someKey0, someKey0);
-        assertNotEquals(((AxKey) someKey0), new AxReferenceKey());
+        // disabling sonar because this code tests the equals() method
+        assertEquals(someKey0, someKey0); // NOSONAR
+        assertNotEquals(someKey0, new AxReferenceKey());
 
         AxArtifactKey nullKey0 = AxArtifactKey.getNullKey();
         assertTrue(nullKey0.isNullKey());
index 5236143..4c60202 100644 (file)
@@ -60,10 +60,10 @@ public class AxKeyUseTest {
         assertEquals("AxKeyUse:(usedKey=AxArtifactKey:(name=Key,version=0.0.1))", clonedKeyUse.toString());
 
         assertNotEquals(0, keyUse.hashCode());
-
-        assertEquals(keyUse, keyUse);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(keyUse, keyUse); // NOSONAR
         assertEquals(keyUse, clonedKeyUse);
-        assertNotEquals(keyUse, (Object) "Hello");
+        assertNotEquals(keyUse, "Hello");
         assertEquals(keyUse, new AxKeyUse(key));
 
         assertEquals(0, keyUse.compareTo(keyUse));
index 49a14dd..e7bbef4 100644 (file)
@@ -86,10 +86,10 @@ public class AxReferenceKeyTest {
             clonedReferenceKey.toString());
 
         assertNotEquals(0, testReferenceKey.hashCode());
-
-        assertEquals(testReferenceKey, testReferenceKey);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(testReferenceKey, testReferenceKey); // NOSONAR
         assertEquals(testReferenceKey, clonedReferenceKey);
-        assertNotEquals(testReferenceKey, (Object) "Hello");
+        assertNotEquals(testReferenceKey, "Hello");
         assertNotEquals(testReferenceKey, new AxReferenceKey("PKN", "0.0.2", "PLN", "LN"));
         assertNotEquals(testReferenceKey, new AxReferenceKey("NPKN", "0.0.2", "PLN", "LN"));
         assertNotEquals(testReferenceKey, new AxReferenceKey("NPKN", "0.0.1", "PLN", "LN"));
index 8676362..c2657bc 100644 (file)
@@ -69,10 +69,11 @@ public class SupportApexBasicModelConceptsTester {
 
         assertNotEquals(0, model.hashCode());
 
-        assertEquals(model, model);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
         assertNotNull(model);
-        assertNotEquals(model, (Object) "Hello");
+        assertNotEquals(model, "Hello");
         clonedModel.getKey().setVersion("0.0.2");
         assertNotEquals(model, clonedModel);
         clonedModel.getKey().setVersion("0.0.1");
@@ -94,7 +95,7 @@ public class SupportApexBasicModelConceptsTester {
         final AxKeyInformation clonedKeyI = new AxKeyInformation(keyI);
 
         assertNotNull(keyI);
-        assertNotEquals(keyI, (Object) new AxArtifactKey());
+        assertNotEquals(keyI, new AxArtifactKey());
         assertEquals(keyI, clonedKeyI);
 
         clonedKeyI.setKey(new AxArtifactKey());
index 74b000f..2e2005f 100644 (file)
@@ -115,11 +115,11 @@ public class ContextAlbumsTest {
                         + "AxArtifactKey:(name=AlbumSchemaName,version=0.0.1))", clonedAlbum.toString());
 
         assertNotEquals(0, album.hashCode());
-
-        assertEquals(album, album);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(album, album); // NOSONAR
         assertEquals(album, clonedAlbum);
         assertNotNull(album);
-        assertNotEquals(album, (Object) "Hello");
+        assertNotEquals(album, "Hello");
         assertNotEquals(album, new AxContextAlbum(new AxArtifactKey(), "Scope", false, AxArtifactKey.getNullKey()));
         assertNotEquals(album, new AxContextAlbum(newKey, "Scope", false, AxArtifactKey.getNullKey()));
         assertNotEquals(album, new AxContextAlbum(newKey, "NewAlbumScope", false, AxArtifactKey.getNullKey()));
@@ -183,10 +183,9 @@ public class ContextAlbumsTest {
 
         assertNotEquals(0, albums.hashCode());
 
-        assertEquals(albums, albums);
         assertEquals(albums, clonedAlbums);
         assertNotNull(albums);
-        assertNotEquals(albums, (Object) "Hello");
+        assertNotEquals(albums, "Hello");
         assertNotEquals(albums, new AxContextAlbums(new AxArtifactKey()));
 
         assertEquals(0, albums.compareTo(albums));
index 1be226c..ae6de38 100644 (file)
@@ -60,9 +60,10 @@ public class ContextModelTest {
 
         assertNotEquals(0, model.hashCode());
 
-        assertEquals(model, model);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
-        assertNotEquals(model, (Object) "Hello");
+        assertNotEquals(model, "Hello");
         assertNotEquals(model, new AxContextModel(new AxArtifactKey()));
         assertNotEquals(model, new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(),
                         new AxKeyInformation()));
index abe7c00..55844d9 100644 (file)
@@ -103,10 +103,11 @@ public class ContextSchemasTest {
 
         assertNotEquals(0, schema.hashCode());
 
-        assertEquals(schema, schema);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(schema, schema); // NOSONAR
         assertEquals(schema, clonedSchema);
         assertNotNull(schema);
-        assertNotEquals(schema, (Object) "Hello");
+        assertNotEquals(schema, "Hello");
         assertNotEquals(schema, new AxContextSchema(new AxArtifactKey(), "Flavour", "Def"));
         assertNotEquals(schema, new AxContextSchema(newKey, "Flavour", "Def"));
         assertNotEquals(schema, new AxContextSchema(newKey, "NewSchemaFlavour", "Def"));
@@ -165,10 +166,9 @@ public class ContextSchemasTest {
 
         assertNotEquals(0, schemas.hashCode());
 
-        assertEquals(schemas, schemas);
         assertEquals(schemas, clonedSchemas);
         assertNotNull(schemas);
-        assertNotEquals(schemas, (Object) "Hello");
+        assertNotEquals(schemas, "Hello");
         assertNotEquals(schemas, new AxContextSchemas(new AxArtifactKey()));
 
         assertEquals(0, schemas.compareTo(schemas));
index f3f2fb6..9d1c7bf 100644 (file)
@@ -98,9 +98,10 @@ public class EngineModelTest {
 
         assertNotEquals(0, model.hashCode());
 
-        assertEquals(model, model);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
-        assertNotEquals(model, (Object) "Hello");
+        assertNotEquals(model, "Hello");
         assertNotEquals(model, new AxEngineModel(new AxArtifactKey()));
         assertNotEquals(model, new AxEngineModel(new AxArtifactKey(), new AxContextSchemas(schemasKey),
                 new AxKeyInformation(keyInfoKey), new AxContextAlbums(albumKey), AxEngineState.READY, stats));
index 5cb1bd4..7669f67 100644 (file)
@@ -134,7 +134,8 @@ public class EngineStatsTest {
 
         assertNotEquals(0, stats.hashCode());
 
-        assertEquals(stats, stats);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(stats, stats); // NOSONAR
         assertEquals(stats, clonedStats);
         assertNotNull(stats);
 
index c86ba12..1731bcd 100644 (file)
@@ -58,10 +58,10 @@ public class EventModelTest {
         final AxEventModel clonedModel = new AxEventModel(model);
 
         assertNotEquals(0, model.hashCode());
-
-        assertEquals(model, model);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
-        assertNotEquals(model, (Object) "Hello");
+        assertNotEquals(model, "Hello");
         assertNotEquals(model, new AxEventModel(new AxArtifactKey()));
         assertNotEquals(model, new AxEventModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey),
                 new AxEvents(eventsKey)));
index 629df1a..a2d562a 100644 (file)
@@ -187,10 +187,11 @@ public class EventsTest {
 
         assertNotEquals(0, event.hashCode());
 
-        assertEquals(event, event);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(event, event); // NOSONAR
         assertEquals(event, clonedEvent);
         assertNotNull(event);
-        assertNotEquals(event, (Object) "Hello");
+        assertNotEquals(event, "Hello");
         assertNotEquals(
                 event, new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap));
         assertNotEquals(event, new AxEvent(eventKey, "namespace1", "source", "target", parameterMap));
@@ -270,10 +271,9 @@ public class EventsTest {
 
         assertNotEquals(0, events.hashCode());
 
-        assertEquals(events, events);
         assertEquals(events, clonedEvents);
         assertNotNull(events);
-        assertNotEquals(events, (Object) "Hello");
+        assertNotEquals(events, "Hello");
         assertNotEquals(events, new AxEvents(new AxArtifactKey()));
 
         assertEquals(0, events.compareTo(events));
index e5a01ed..dd76d32 100644 (file)
@@ -109,11 +109,11 @@ public class FieldTest {
                         + "AxArtifactKey:(name=SchemaName,version=0.0.1),optional=true)", clonedField.toString());
 
         assertNotEquals(0, field.hashCode());
-
-        assertEquals(field, field);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(field, field); // NOSONAR
         assertEquals(field, clonedField);
         assertNotNull(field);
-        assertNotEquals(field, (Object) "Hello");
+        assertNotEquals(field, "Hello");
         assertNotEquals(field, new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false));
         assertNotEquals(field, new AxField(fieldKey, AxArtifactKey.getNullKey(), false));
         assertNotEquals(field, new AxField(fieldKey, schemaKey, false));
index 7961d8e..c9dbac3 100644 (file)
@@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
 
 import org.junit.Test;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -138,11 +137,11 @@ public class LogicTest {
                         clonedLogic.toString());
 
         assertNotEquals(0, logic.hashCode());
-
-        assertEquals(logic, logic);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(logic, logic); // NOSONAR
         assertEquals(logic, clonedLogic);
         assertNotNull(logic);
-        assertNotEquals(logic, (Object) "Hello");
+        assertNotEquals(logic, "Hello");
         assertNotEquals(logic, new AxLogic(AxReferenceKey.getNullKey(), "LogicFlavour", "Logic"));
         assertNotEquals(logic, new AxLogic(logicKey, "AnotherLogicFlavour", "Logic"));
         assertNotEquals(logic, new AxLogic(logicKey, "LogicFlavour", "AnotherLogic"));
index 662b8bd..7b0dbaf 100644 (file)
@@ -209,11 +209,11 @@ public class PoliciesTest {
                         clonedPolicy.toString().substring(0, 77));
 
         assertNotEquals(0, policyPN.hashCode());
-
-        assertEquals(policyPN, policyPN);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(policyPN, policyPN); // NOSONAR
         assertEquals(policyPN, clonedPolicy);
         assertNotNull(policyPN);
-        assertNotEquals(policyPN, (Object) "Hello");
+        assertNotEquals(policyPN, "Hello");
         assertNotEquals(policyPN,
                         new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState));
         assertNotEquals(policyPN, new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState));
@@ -294,11 +294,11 @@ public class PoliciesTest {
                         clonedPolicies.toString().substring(0, 60));
 
         assertNotEquals(0, policies.hashCode());
-
-        assertEquals(policies, policies);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(policies, policies); // NOSONAR
         assertEquals(policies, clonedPolicies);
         assertNotNull(policies);
-        assertNotEquals(policies, (Object) "Hello");
+        assertNotEquals(policies, "Hello");
         assertNotEquals(policies, new AxPolicies(new AxArtifactKey()));
 
         assertEquals(0, policies.compareTo(policies));
index 829f933..30b92ca 100644 (file)
@@ -79,9 +79,10 @@ public class PolicyModelTest {
 
         assertNotEquals(0, model.hashCode());
 
-        assertEquals(model, model);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
-        assertNotEquals(model, (Object) "Hello");
+        assertNotEquals(model, "Hello");
         assertNotEquals(model, new AxPolicyModel(new AxArtifactKey()));
         assertNotEquals(model, new AxPolicyModel(AxArtifactKey.getNullKey(), new AxContextSchemas(schemasKey),
                         new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey),
index ff3267c..7e243f5 100644 (file)
@@ -99,10 +99,11 @@ public class StateOutputTest {
 
         assertNotEquals(0, so.hashCode());
 
-        assertEquals(so, so);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(so, so); // NOSONAR
         assertEquals(so, clonedPar);
         assertNotNull(so);
-        assertNotEquals(so, (Object) "Hello");
+        assertNotEquals(so, "Hello");
         assertNotEquals(so, new AxStateOutput(AxReferenceKey.getNullKey(), eKey, nsKey));
         assertNotEquals(so, new AxStateOutput(soKey, new AxArtifactKey(), nsKey));
         assertNotEquals(so, new AxStateOutput(soKey, eKey, new AxReferenceKey()));
index 31012c6..d1cd3ed 100644 (file)
@@ -114,10 +114,11 @@ public class StateTaskReferenceTest {
 
         assertNotEquals(0, stRef.hashCode());
 
-        assertEquals(stRef, stRef);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(stRef, stRef); // NOSONAR
         assertEquals(stRef, clonedStRef);
         assertNotNull(stRef);
-        assertNotEquals(stRef, (Object) "Hello");
+        assertNotEquals(stRef, "Hello");
         assertNotEquals(stRef, new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC,
                         soKey));
         assertNotEquals(stRef, new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey));
index 4c5ad4a..4fe5541 100644 (file)
@@ -383,11 +383,11 @@ public class StateTest {
         assertEquals("AxState:(stateKey=AxReferenceKey:(parent", clonedState.toString().substring(0, 40));
 
         assertNotEquals(0, state.hashCode());
-
-        assertEquals(state, state);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(state, state); // NOSONAR
         assertEquals(state, clonedState);
         assertNotNull(state);
-        assertNotEquals(state, (Object) "Hello");
+        assertNotEquals(state, "Hello");
         assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(new AxReferenceKey()).trigger(triggerKey)
                         .stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl)
                         .stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap)));
index e14dec0..8af1919 100644 (file)
@@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
 
 import org.junit.Test;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -89,11 +88,11 @@ public class TaskParameterTest {
                         + "parentLocalName=PLN,localName=LN),defaultValue=DefaultValue)", clonedPar.toString());
 
         assertNotEquals(0, par.hashCode());
-
-        assertEquals(par, par);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(par, par); // NOSONAR
         assertEquals(par, clonedPar);
         assertNotNull(par);
-        assertNotEquals(par, (Object) "Hello");
+        assertNotEquals(par, "Hello");
         assertNotEquals(par, new AxTaskParameter(AxReferenceKey.getNullKey(), "DefaultValue"));
         assertNotEquals(par, new AxTaskParameter(parKey, "OtherDefaultValue"));
         assertEquals(par, new AxTaskParameter(parKey, "DefaultValue"));
index 4f19e61..6a6c658 100644 (file)
@@ -219,11 +219,11 @@ public class TasksTest {
         assertEquals("AxTask:(key=AxArtifactKey:(name=TaskName", clonedTask.toString().substring(0, 40));
 
         assertNotEquals(0, task.hashCode());
-
-        assertEquals(task, task);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(task, task); // NOSONAR
         assertEquals(task, clonedTask);
         assertNotNull(task);
-        assertNotEquals(task, (Object) "Hello");
+        assertNotEquals(task, "Hello");
         assertNotEquals(task, new AxTask(new AxArtifactKey(), ifMap, ofMap, tpMap, ctxtSet, tl));
         assertNotEquals(task, new AxTask(taskKey, ifEmptyMap, ofMap, tpMap, ctxtSet, tl));
         assertNotEquals(task, new AxTask(taskKey, ifMap, ofEmptyMap, tpMap, ctxtSet, tl));
@@ -303,10 +303,11 @@ public class TasksTest {
 
         assertNotEquals(0, tasks.hashCode());
 
-        assertEquals(tasks, tasks);
+        // disabling sonar because this code tests the equals() method
+        assertEquals(tasks, tasks); // NOSONAR
         assertEquals(tasks, clonedTasks);
         assertNotNull(tasks);
-        assertNotEquals(tasks, (Object) "Hello");
+        assertNotEquals(tasks, "Hello");
         assertNotEquals(tasks, new AxTasks(new AxArtifactKey()));
 
         assertEquals(0, tasks.compareTo(tasks));