From d879346e830b810eeccf8283fa16e04a9cfafbc8 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Tue, 7 Jul 2020 13:18:20 +0100 Subject: Fix assertTrue SONAR issues in apex-pdp/contex and apex-pdp/core Replace assertTrue with assertEquals and assertFalse with assertNotEquals in apex-pdp/client apex-pdp/context and apex-pdp/core Issue-ID: POLICY-2690 Change-Id: Ic1e69c75e5f8f887cac135b6728b007faf4b19a6 Signed-off-by: JvD_Ericsson --- .../client/monitoring/rest/RestResourceTest.java | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'client/client-monitoring/src/test') diff --git a/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java b/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java index a63224590..469f09586 100644 --- a/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java +++ b/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 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. * 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. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -21,7 +22,8 @@ package org.onap.policy.apex.client.monitoring.rest; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import javax.ws.rs.core.Response; @@ -46,7 +48,7 @@ public class RestResourceTest { /** * Set up mocking of the engine service facade. - * + * * @throws ApexException on engine service facade setup errors */ @Before @@ -228,30 +230,30 @@ public class RestResourceTest { ApexMonitoringRestResource.SlidingWindowList slidingWindowList0 = restResource.new SlidingWindowList<>( 2); - assertFalse(slidingWindowList0.hashCode() == 0); - + assertNotEquals(0, slidingWindowList0.hashCode()); + assertTrue(slidingWindowList0.add("Hello")); assertTrue(slidingWindowList0.add("Hi")); assertTrue(slidingWindowList0.add("Howdy")); - - assertFalse(slidingWindowList0.equals(null)); - assertTrue(slidingWindowList0.equals(slidingWindowList0)); + + assertNotNull(slidingWindowList0); + assertEquals(slidingWindowList0, slidingWindowList0); ApexMonitoringRestResource.SlidingWindowList slidingWindowList1 = restResource.new SlidingWindowList<>( 2); ApexMonitoringRestResource.SlidingWindowList slidingWindowList2 = restResource.new SlidingWindowList<>( 2); - assertFalse(slidingWindowList0.equals(slidingWindowList1)); - assertFalse(slidingWindowList0.equals(slidingWindowList2)); - assertTrue(slidingWindowList1.equals(slidingWindowList2)); + assertNotEquals(slidingWindowList0, slidingWindowList1); + assertNotEquals(slidingWindowList0, slidingWindowList2); + assertEquals(slidingWindowList1, slidingWindowList2); ApexMonitoringRestResource.SlidingWindowList slidingWindowList3 = restResource.new SlidingWindowList<>( 3); - assertFalse(slidingWindowList1.equals(slidingWindowList3)); + assertNotEquals(slidingWindowList1, slidingWindowList3); ApexMonitoringRestResource.SlidingWindowList slidingWindowList4 = restResource.new SlidingWindowList<>( 3); assertTrue(slidingWindowList3.add("Hello")); assertTrue(slidingWindowList4.add(10)); - assertFalse(slidingWindowList3.equals(slidingWindowList4)); + assertNotEquals(slidingWindowList3, slidingWindowList4); } @Test -- cgit 1.2.3-korg