diff options
Diffstat (limited to 'model/basic-model/src')
6 files changed, 18 insertions, 16 deletions
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java index fc876d8ea..446a00a68 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-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. @@ -100,7 +100,7 @@ public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKey * @param key the key of the concept */ public AxKeyInformation(final AxArtifactKey key) { - this(key, new TreeMap<AxArtifactKey, AxKeyInfo>()); + this(key, new TreeMap<>()); } /** 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()); |