aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-07-13 12:55:42 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-13 12:55:42 +0000
commit2649f1da1ac58352d6d11c48923ee86930e3e8ee (patch)
treeb612c05875a07c690be1372e11c53281b4ea5871 /client
parentb09f7de07ee653397d1287314260f1df67b66bf6 (diff)
parentd879346e830b810eeccf8283fa16e04a9cfafbc8 (diff)
Merge "Fix assertTrue SONAR issues in apex-pdp/contex and apex-pdp/core"
Diffstat (limited to 'client')
-rw-r--r--client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java2
-rw-r--r--client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/RestResourceTest.java32
2 files changed, 18 insertions, 16 deletions
diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java
index a1d0a7b3f..a5ba0f44b 100644
--- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java
+++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java
@@ -140,7 +140,7 @@ public class RestInterfaceTest {
private static int createNewSession() {
final ApexApiResult responseMsg = target.path("editor/-1/Session/Create").request().get(ApexApiResult.class);
assertEquals(ApexApiResult.Result.SUCCESS, responseMsg.getResult());
- assertTrue(responseMsg.getMessages().size() == 1);
+ assertEquals(1, responseMsg.getMessages().size());
return Integer.parseInt(responseMsg.getMessages().get(0));
}
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<String> 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<String> slidingWindowList1 = restResource.new SlidingWindowList<>(
2);
ApexMonitoringRestResource.SlidingWindowList<String> 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<String> slidingWindowList3 = restResource.new SlidingWindowList<>(
3);
- assertFalse(slidingWindowList1.equals(slidingWindowList3));
+ assertNotEquals(slidingWindowList1, slidingWindowList3);
ApexMonitoringRestResource.SlidingWindowList<Integer> slidingWindowList4 = restResource.new SlidingWindowList<>(
3);
assertTrue(slidingWindowList3.add("Hello"));
assertTrue(slidingWindowList4.add(10));
- assertFalse(slidingWindowList3.equals(slidingWindowList4));
+ assertNotEquals(slidingWindowList3, slidingWindowList4);
}
@Test