diff options
author | waynedunican <wayne.dunican@est.tech> | 2020-08-07 09:51:52 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2020-08-10 11:34:03 +0100 |
commit | 09212e0d7326c2933ed437ee36188a241b8cf900 (patch) | |
tree | 03f33a3a95ab0aa086c38e22c1fd0ffdb715fa94 /model/policy-model/src/test | |
parent | a926cdc113b5fad19a34dbf45e66bd7cbb5ed6e0 (diff) |
SONAR assertion cleanup
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>
Diffstat (limited to 'model/policy-model/src/test')
8 files changed, 30 insertions, 28 deletions
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java index 7961d8e8e..c9dbac3e0 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java @@ -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")); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java index 662b8bd02..7b0dbaf86 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java @@ -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)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java index 829f93342..30b92ca4c 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java @@ -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), diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java index ff3267c8c..7e243f567 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateOutputTest.java @@ -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())); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java index 31012c68c..d1cd3ede3 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTaskReferenceTest.java @@ -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)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java index 4c5ad4ad3..4fe554137 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java @@ -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))); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java index e14dec059..8af19190a 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TaskParameterTest.java @@ -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")); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java index 4f19e6100..6a6c6589f 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java @@ -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)); |