SONAR fixes - assert dissimiliar types 72/111272/3
authorwaynedunican <wayne.dunican@est.tech>
Fri, 14 Aug 2020 10:24:14 +0000 (11:24 +0100)
committerwaynedunican <wayne.dunican@est.tech>
Mon, 17 Aug 2020 13:13:13 +0000 (14:13 +0100)
Fix for assertions comparing dissimiliar types.

Issue-ID: POLICY-2761
Change-Id: I1b2b8afa3e6308cda887d73a4ee079709847d054
Signed-off-by: waynedunican <wayne.dunican@est.tech>
22 files changed:
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.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/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
testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java

index 6e588db..445f831 100644 (file)
@@ -74,7 +74,7 @@ public class EngineServiceInfoResponseTest {
         // disabling sonar because this code tests the equals() method
         assertEquals(response, response); // NOSONAR
         assertNotNull(response);
-        assertNotEquals(response, new StartEngine(new AxArtifactKey()));
+        assertNotEquals(response, (Object) new StartEngine(new AxArtifactKey()));
 
         response = new EngineServiceInfoResponse(null, false, null);
         EngineServiceInfoResponse otherResponse = new EngineServiceInfoResponse(null, false, null);
index b22d45c..5a57ba3 100644 (file)
@@ -62,7 +62,7 @@ public class AxKeyInfoTest {
         assertEquals(testKeyInfo, testKeyInfo); // NOSONAR
         assertEquals(testKeyInfo, clonedReferenceKey);
         assertNotNull(testKeyInfo);
-        assertNotEquals(testKeyInfo, new AxArtifactKey());
+        assertNotEquals(testKeyInfo, (Object) 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 60c848d..1e8e7f5 100644 (file)
@@ -111,7 +111,7 @@ public class AxKeyTest {
         assertNotNull(someKey0);
         // disabling sonar because this code tests the equals() method
         assertEquals(someKey0, someKey0); // NOSONAR
-        assertNotEquals(someKey0, new AxReferenceKey());
+        assertNotEquals(someKey0, (Object) new AxReferenceKey());
 
         AxArtifactKey nullKey0 = AxArtifactKey.getNullKey();
         assertTrue(nullKey0.isNullKey());
index 4c60202..5346b6b 100644 (file)
@@ -63,7 +63,7 @@ public class AxKeyUseTest {
         // disabling sonar because this code tests the equals() method
         assertEquals(keyUse, keyUse); // NOSONAR
         assertEquals(keyUse, clonedKeyUse);
-        assertNotEquals(keyUse, "Hello");
+        assertNotEquals(keyUse, (Object) "Hello");
         assertEquals(keyUse, new AxKeyUse(key));
 
         assertEquals(0, keyUse.compareTo(keyUse));
index e7bbef4..5155875 100644 (file)
@@ -89,7 +89,7 @@ public class AxReferenceKeyTest {
         // disabling sonar because this code tests the equals() method
         assertEquals(testReferenceKey, testReferenceKey); // NOSONAR
         assertEquals(testReferenceKey, clonedReferenceKey);
-        assertNotEquals(testReferenceKey, "Hello");
+        assertNotEquals(testReferenceKey, (Object) "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 c2657bc..8ce072c 100644 (file)
@@ -73,7 +73,7 @@ public class SupportApexBasicModelConceptsTester {
         assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
         assertNotNull(model);
-        assertNotEquals(model, "Hello");
+        assertNotEquals(model, (Object) "Hello");
         clonedModel.getKey().setVersion("0.0.2");
         assertNotEquals(model, clonedModel);
         clonedModel.getKey().setVersion("0.0.1");
@@ -95,7 +95,7 @@ public class SupportApexBasicModelConceptsTester {
         final AxKeyInformation clonedKeyI = new AxKeyInformation(keyI);
 
         assertNotNull(keyI);
-        assertNotEquals(keyI, new AxArtifactKey());
+        assertNotEquals(keyI, (Object) new AxArtifactKey());
         assertEquals(keyI, clonedKeyI);
 
         clonedKeyI.setKey(new AxArtifactKey());
index 2e2005f..154739b 100644 (file)
@@ -119,7 +119,7 @@ public class ContextAlbumsTest {
         assertEquals(album, album); // NOSONAR
         assertEquals(album, clonedAlbum);
         assertNotNull(album);
-        assertNotEquals(album, "Hello");
+        assertNotEquals(album, (Object) "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()));
@@ -185,7 +185,7 @@ public class ContextAlbumsTest {
 
         assertEquals(albums, clonedAlbums);
         assertNotNull(albums);
-        assertNotEquals(albums, "Hello");
+        assertNotEquals(albums, (Object) "Hello");
         assertNotEquals(albums, new AxContextAlbums(new AxArtifactKey()));
 
         assertEquals(0, albums.compareTo(albums));
index ae6de38..eab561e 100644 (file)
@@ -63,7 +63,7 @@ public class ContextModelTest {
         // disabling sonar because this code tests the equals() method
         assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
-        assertNotEquals(model, "Hello");
+        assertNotEquals(model, (Object) "Hello");
         assertNotEquals(model, new AxContextModel(new AxArtifactKey()));
         assertNotEquals(model, new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(),
                         new AxKeyInformation()));
index 55844d9..6de0a52 100644 (file)
@@ -107,7 +107,7 @@ public class ContextSchemasTest {
         assertEquals(schema, schema); // NOSONAR
         assertEquals(schema, clonedSchema);
         assertNotNull(schema);
-        assertNotEquals(schema, "Hello");
+        assertNotEquals(schema, (Object) "Hello");
         assertNotEquals(schema, new AxContextSchema(new AxArtifactKey(), "Flavour", "Def"));
         assertNotEquals(schema, new AxContextSchema(newKey, "Flavour", "Def"));
         assertNotEquals(schema, new AxContextSchema(newKey, "NewSchemaFlavour", "Def"));
@@ -168,7 +168,7 @@ public class ContextSchemasTest {
 
         assertEquals(schemas, clonedSchemas);
         assertNotNull(schemas);
-        assertNotEquals(schemas, "Hello");
+        assertNotEquals(schemas, (Object) "Hello");
         assertNotEquals(schemas, new AxContextSchemas(new AxArtifactKey()));
 
         assertEquals(0, schemas.compareTo(schemas));
index 9d1c7bf..5c87e56 100644 (file)
@@ -101,7 +101,7 @@ public class EngineModelTest {
         // disabling sonar because this code tests the equals() method
         assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
-        assertNotEquals(model, "Hello");
+        assertNotEquals(model, (Object) "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 1731bcd..cdc5fec 100644 (file)
@@ -61,7 +61,7 @@ public class EventModelTest {
         // disabling sonar because this code tests the equals() method
         assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
-        assertNotEquals(model, "Hello");
+        assertNotEquals(model, (Object) "Hello");
         assertNotEquals(model, new AxEventModel(new AxArtifactKey()));
         assertNotEquals(model, new AxEventModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey),
                 new AxEvents(eventsKey)));
index a2d562a..21601d7 100644 (file)
@@ -191,7 +191,7 @@ public class EventsTest {
         assertEquals(event, event); // NOSONAR
         assertEquals(event, clonedEvent);
         assertNotNull(event);
-        assertNotEquals(event, "Hello");
+        assertNotEquals(event, (Object) "Hello");
         assertNotEquals(
                 event, new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap));
         assertNotEquals(event, new AxEvent(eventKey, "namespace1", "source", "target", parameterMap));
@@ -273,7 +273,7 @@ public class EventsTest {
 
         assertEquals(events, clonedEvents);
         assertNotNull(events);
-        assertNotEquals(events, "Hello");
+        assertNotEquals(events, (Object) "Hello");
         assertNotEquals(events, new AxEvents(new AxArtifactKey()));
 
         assertEquals(0, events.compareTo(events));
index dd76d32..6ec46db 100644 (file)
@@ -113,7 +113,7 @@ public class FieldTest {
         assertEquals(field, field); // NOSONAR
         assertEquals(field, clonedField);
         assertNotNull(field);
-        assertNotEquals(field, "Hello");
+        assertNotEquals(field, (Object) "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 c9dbac3..fbfc7c4 100644 (file)
@@ -141,7 +141,7 @@ public class LogicTest {
         assertEquals(logic, logic); // NOSONAR
         assertEquals(logic, clonedLogic);
         assertNotNull(logic);
-        assertNotEquals(logic, "Hello");
+        assertNotEquals(logic, (Object) "Hello");
         assertNotEquals(logic, new AxLogic(AxReferenceKey.getNullKey(), "LogicFlavour", "Logic"));
         assertNotEquals(logic, new AxLogic(logicKey, "AnotherLogicFlavour", "Logic"));
         assertNotEquals(logic, new AxLogic(logicKey, "LogicFlavour", "AnotherLogic"));
index 7b0dbaf..e724a46 100644 (file)
@@ -213,7 +213,7 @@ public class PoliciesTest {
         assertEquals(policyPN, policyPN); // NOSONAR
         assertEquals(policyPN, clonedPolicy);
         assertNotNull(policyPN);
-        assertNotEquals(policyPN, "Hello");
+        assertNotEquals(policyPN, (Object) "Hello");
         assertNotEquals(policyPN,
                         new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState));
         assertNotEquals(policyPN, new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState));
@@ -298,7 +298,7 @@ public class PoliciesTest {
         assertEquals(policies, policies); // NOSONAR
         assertEquals(policies, clonedPolicies);
         assertNotNull(policies);
-        assertNotEquals(policies, "Hello");
+        assertNotEquals(policies, (Object) "Hello");
         assertNotEquals(policies, new AxPolicies(new AxArtifactKey()));
 
         assertEquals(0, policies.compareTo(policies));
index 30b92ca..86bbf3e 100644 (file)
@@ -82,7 +82,7 @@ public class PolicyModelTest {
         // disabling sonar because this code tests the equals() method
         assertEquals(model, model); // NOSONAR
         assertEquals(model, clonedModel);
-        assertNotEquals(model, "Hello");
+        assertNotEquals(model, (Object) "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 7e243f5..8bd29fc 100644 (file)
@@ -103,7 +103,7 @@ public class StateOutputTest {
         assertEquals(so, so); // NOSONAR
         assertEquals(so, clonedPar);
         assertNotNull(so);
-        assertNotEquals(so, "Hello");
+        assertNotEquals(so, (Object) "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 d1cd3ed..568c47f 100644 (file)
@@ -118,7 +118,7 @@ public class StateTaskReferenceTest {
         assertEquals(stRef, stRef); // NOSONAR
         assertEquals(stRef, clonedStRef);
         assertNotNull(stRef);
-        assertNotEquals(stRef, "Hello");
+        assertNotEquals(stRef, (Object) "Hello");
         assertNotEquals(stRef, new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC,
                         soKey));
         assertNotEquals(stRef, new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey));
index 4fe5541..95a9132 100644 (file)
@@ -387,7 +387,7 @@ public class StateTest {
         assertEquals(state, state); // NOSONAR
         assertEquals(state, clonedState);
         assertNotNull(state);
-        assertNotEquals(state, "Hello");
+        assertNotEquals(state, (Object) "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 8af1919..4255b49 100644 (file)
@@ -92,7 +92,7 @@ public class TaskParameterTest {
         assertEquals(par, par); // NOSONAR
         assertEquals(par, clonedPar);
         assertNotNull(par);
-        assertNotEquals(par, "Hello");
+        assertNotEquals(par, (Object) "Hello");
         assertNotEquals(par, new AxTaskParameter(AxReferenceKey.getNullKey(), "DefaultValue"));
         assertNotEquals(par, new AxTaskParameter(parKey, "OtherDefaultValue"));
         assertEquals(par, new AxTaskParameter(parKey, "DefaultValue"));
index 6a6c658..100adb9 100644 (file)
@@ -223,7 +223,7 @@ public class TasksTest {
         assertEquals(task, task); // NOSONAR
         assertEquals(task, clonedTask);
         assertNotNull(task);
-        assertNotEquals(task, "Hello");
+        assertNotEquals(task, (Object) "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));
@@ -307,7 +307,7 @@ public class TasksTest {
         assertEquals(tasks, tasks); // NOSONAR
         assertEquals(tasks, clonedTasks);
         assertNotNull(tasks);
-        assertNotEquals(tasks, "Hello");
+        assertNotEquals(tasks, (Object) "Hello");
         assertNotEquals(tasks, new AxTasks(new AxArtifactKey()));
 
         assertEquals(0, tasks.compareTo(tasks));
index ba4b225..7500088 100644 (file)
@@ -180,19 +180,15 @@ public class TestEventInstantiation {
         assertEquals("This is a slogan", slogan2);
 
         final byte mc21 = (byte) event.get("TestMatchCase");
-        assertNotNull(mc21);
         assertEquals(16, mc21);
 
         final byte mc22 = (byte) event.get("TestMatchCase");
-        assertNotNull(mc22);
         assertEquals((byte) 16, mc22);
 
         final long timestamp2 = (Long) event.get("TestTimestamp");
-        assertNotNull(timestamp2);
         assertEquals(timestamp2, timestamp1);
 
         final double temp2 = (double) event.get("TestTemperature");
-        assertNotNull(temp2);
         assertEquals(123.456789, temp2, 0);
 
         final Double temp3 = (Double) event.get("TestTemperature");
@@ -213,15 +209,12 @@ public class TestEventInstantiation {
         assertEquals("This is a test slogan", slogan3);
 
         final byte mc31 = (byte) event.get("TestMatchCase");
-        assertNotNull(mc31);
         assertEquals((byte) 123, mc31);
 
         final long timestamp3 = (Long) event.get("TestTimestamp");
-        assertNotNull(timestamp3);
         assertEquals(timestamp3, aDate.getTime());
 
         final double temp4 = (double) event.get("TestTemperature");
-        assertNotNull(temp4);
         assertEquals(34.5445667, temp4, 0);
 
         logger.debug(event.toString());