From 248a660d61fa03caa4710cf8cfe144eb245b807b Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 21 Jul 2020 09:55:38 -0400 Subject: Fix some sonars in policy-models Fixed the following sonar issues in some of the project directories: - use assertNull, assertEquals, etc. - swap assertEquals arguments - extract a constant - don't invoke toString() in logger calls - TODOs - generic types Issue-ID: POLICY-2714 Change-Id: Id8803f9bf617ea9fc173a67b8606600709b55bdc Signed-off-by: Jim Hahn --- .../org/onap/policy/aai/util/AaiException.java | 50 ---------------------- .../org/onap/policy/aai/util/Serialization.java | 4 +- .../org/onap/policy/aai/util/AaiExceptionTest.java | 42 ------------------ 3 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java delete mode 100644 models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java (limited to 'models-interactions/model-impl/aai') diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java deleted file mode 100644 index 83923f1bb..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai.util; - -public class AaiException extends Exception { - - // TODO remove this class - - private static final long serialVersionUID = 9220983727706207465L; - - public AaiException() { - super(); - } - - public AaiException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - - public AaiException(String message, Throwable cause) { - super(message, cause); - } - - public AaiException(String message) { - super(message); - } - - public AaiException(Throwable cause) { - super(cause); - } - -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java index 326294aab..7a14a854f 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,8 +26,6 @@ import com.google.gson.GsonBuilder; public final class Serialization { - // TODO remove this class - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); private Serialization() { diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java deleted file mode 100644 index caee19a87..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai.util; - -import static org.junit.Assert.assertNotNull; - -import java.io.IOException; -import org.junit.Test; - -public class AaiExceptionTest { - - private static final String MESSAGE = "message"; - - @Test - public void test() { - assertNotNull(new AaiException()); - assertNotNull(new AaiException(MESSAGE)); - assertNotNull(new AaiException(MESSAGE, new IOException())); - assertNotNull(new AaiException(MESSAGE, new IOException(), true, false)); - assertNotNull(new AaiException(new IOException())); - } - -} -- cgit 1.2.3-korg