diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2020-08-26 11:13:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-26 11:13:19 +0000 |
commit | 68a60a45f27287a4a523c82ef466cbeec655f641 (patch) | |
tree | cf52bf9fd0610d27f5d0aadcc5e3a8cd81ba5a50 /models-base | |
parent | 8ec1942774a2f26225d116ffba5b9b48e90ba15a (diff) | |
parent | 59f4f54cdf4c1a5c155360239272da690e8c4a72 (diff) |
Merge "Address more sonar issues in policy-models"
Diffstat (limited to 'models-base')
6 files changed, 8 insertions, 10 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java index 144d6e61d..b8f2ed6cb 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java @@ -106,7 +106,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex * @param key the concept key */ public PfConceptContainer(@NonNull final PfConceptKey key) { - this(key, new TreeMap<PfConceptKey, C>()); + this(key, new TreeMap<>()); } /** diff --git a/models-base/src/main/java/org/onap/policy/models/base/Validated.java b/models-base/src/main/java/org/onap/policy/models/base/Validated.java index 26a8a5260..d79d58f13 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/Validated.java +++ b/models-base/src/main/java/org/onap/policy/models/base/Validated.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,14 +70,13 @@ public class Validated { * @param result where to place the result * @return the result */ - @SuppressWarnings("java:S3252") // squelch sonar warning for using PkConceptKey instead of PfKeyImpl public PfValidationResult validateNotNull(@NonNull PfConceptKey value, @NonNull PfValidationResult result) { - if (PfConceptKey.NULL_KEY_NAME.equals(value.getName())) { + if (PfKey.NULL_KEY_NAME.equals(value.getName())) { addError(value, "name", result, "null"); } - if (PfConceptKey.NULL_KEY_VERSION.equals(value.getVersion())) { + if (PfKey.NULL_KEY_VERSION.equals(value.getVersion())) { addError(value, "version", result, "null"); } diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java index 8ff5e509c..7bf270b5f 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java @@ -139,8 +139,8 @@ public class PfKeyImplTest { assertEquals(-36, someKey0.compareTo(new DummyPfKey())); assertNotEquals(someKey0, null); - assertEquals(someKey0, someKey0); - assertNotEquals(someKey0, new DummyPfKey()); + assertEquals(someKey0, (Object) someKey0); + assertNotEquals(someKey0, (Object) new DummyPfKey()); MyKey someKey8 = new MyKey(); someKey8.setVersion(VERSION001); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java index e4933b2b9..f9ad889c7 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java @@ -73,7 +73,7 @@ public class PfKeyUseTest { assertNotEquals(0, keyUse.hashCode()); - assertEquals(keyUse, keyUse); + assertEquals(keyUse, (Object) keyUse); assertEquals(keyUse, clonedKeyUse); assertNotEquals(keyUse, (Object) "Hello"); assertEquals(keyUse, new PfKeyUse(key)); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java index c1c13c8b3..a27a5ddea 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java @@ -105,7 +105,7 @@ public class PfReferenceKeyTest { assertNotEquals(0, testReferenceKey.hashCode()); - assertEquals(testReferenceKey, testReferenceKey); + assertEquals(testReferenceKey, (Object) testReferenceKey); assertEquals(testReferenceKey, clonedReferenceKey); assertNotEquals(testReferenceKey, (Object) "Hello"); assertNotEquals(testReferenceKey, new PfReferenceKey("PKN", VERSION002, "PLN", "LN")); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java index f5f5ad002..19f8ee988 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java @@ -23,7 +23,6 @@ package org.onap.policy.models.base; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; |