From aa987aab348f13d477c6cf32e61689d396ebfba5 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Wed, 8 Jul 2020 13:21:57 +0100 Subject: Fix assertTrue SONAR issues in apex-pdp/examples and apex-pdp/model Replace assertTrue with assertEquals and assertFalse with assertNotEquals in apex-pdp/examples and apex-pdp/model Issue-ID: POLICY-2690 Change-Id: Ie863dd95ccead62268689a4a8388f9b6e8821649 Signed-off-by: JvD_Ericsson --- .../apex/examples/myfirstpolicy/MfpUseCaseTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'examples/examples-myfirstpolicy/src/test/java/org') diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java index c495bd32b..8afe7d7cd 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java @@ -308,12 +308,12 @@ public class MfpUseCaseTest { gb.create().fromJson(ResourceUtils.getResourceAsString(inputFile), JsonObject.class); assertNotNull(jsonObject); assertTrue(jsonObject.has("name")); - assertTrue(ret.getName().equals(jsonObject.get("name").getAsString())); - assertTrue(ret.getAxEvent().getKey().getName().equals(jsonObject.get("name").getAsString())); + assertEquals(ret.getName(), jsonObject.get("name").getAsString()); + assertEquals(ret.getAxEvent().getKey().getName(), jsonObject.get("name").getAsString()); assertTrue(jsonObject.has("nameSpace")); - assertTrue(ret.getAxEvent().getNameSpace().equals(jsonObject.get("nameSpace").getAsString())); + assertEquals(ret.getAxEvent().getNameSpace(), jsonObject.get("nameSpace").getAsString()); assertTrue(jsonObject.has("version")); - assertTrue(ret.getAxEvent().getKey().getVersion().equals(jsonObject.get("version").getAsString())); + assertEquals(ret.getAxEvent().getKey().getVersion(), jsonObject.get("version").getAsString()); final List reserved = Arrays.asList("name", "nameSpace", "version", "source", "target"); for (final Map.Entry e : jsonObject.entrySet()) { if (reserved.contains(e.getKey())) { @@ -375,12 +375,12 @@ public class MfpUseCaseTest { gb.create().fromJson(ResourceUtils.getResourceAsString(inputFile), JsonObject.class); assertNotNull(jsonObject); assertTrue(jsonObject.has("name")); - assertTrue(ret.getName().equals(jsonObject.get("name").getAsString())); - assertTrue(ret.getAxEvent().getKey().getName().equals(jsonObject.get("name").getAsString())); + assertEquals(ret.getName(), jsonObject.get("name").getAsString()); + assertEquals(ret.getAxEvent().getKey().getName(), jsonObject.get("name").getAsString()); assertTrue(jsonObject.has("nameSpace")); - assertTrue(ret.getAxEvent().getNameSpace().equals(jsonObject.get("nameSpace").getAsString())); + assertEquals(ret.getAxEvent().getNameSpace(), jsonObject.get("nameSpace").getAsString()); assertTrue(jsonObject.has("version")); - assertTrue(ret.getAxEvent().getKey().getVersion().equals(jsonObject.get("version").getAsString())); + assertEquals(ret.getAxEvent().getKey().getVersion(), jsonObject.get("version").getAsString()); final List reserved = Arrays.asList("name", "nameSpace", "version", "source", "target"); for (final Map.Entry e : jsonObject.entrySet()) { if (reserved.contains(e.getKey())) { -- cgit 1.2.3-korg