summaryrefslogtreecommitdiffstats
path: root/model/basic-model/src/test
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2020-08-07 09:51:52 +0100
committerwaynedunican <wayne.dunican@est.tech>2020-08-10 11:34:03 +0100
commit09212e0d7326c2933ed437ee36188a241b8cf900 (patch)
tree03f33a3a95ab0aa086c38e22c1fd0ffdb715fa94 /model/basic-model/src/test
parenta926cdc113b5fad19a34dbf45e66bd7cbb5ed6e0 (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/basic-model/src/test')
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java6
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java5
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUseTest.java6
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKeyTest.java6
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java7
5 files changed, 16 insertions, 14 deletions
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java
index 991d020a4..b22d45c05 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java
@@ -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"));
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
index fbbc4a793..60c848d17 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
@@ -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());
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUseTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUseTest.java
index 52361438e..4c6020226 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUseTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUseTest.java
@@ -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));
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKeyTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKeyTest.java
index 49a14dd3c..e7bbef476 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKeyTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKeyTest.java
@@ -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"));
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java
index 8676362dd..c2657bc7e 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java
@@ -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());