Fix assertTrue in apex-pdp/model apex-pdp/plugins, apex-pdp/services and apex-pdp... 65/110165/7
authorJvD_Ericsson <jeff.van.dam@est.tech>
Fri, 17 Jul 2020 13:08:52 +0000 (14:08 +0100)
committerJvD_Ericsson <jeff.van.dam@est.tech>
Tue, 21 Jul 2020 14:35:05 +0000 (15:35 +0100)
Replace assertTrue with assertEquals and assertFalse with
assertNotEquals in apex-pdp/model, apex-pdp/plugins, apex-pdp/services
and apex-pdp/testsuites

Issue-ID: POLICY-2690
Change-Id: If088371cf012d5648e04ade2aa4d49b38945f6d2
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
17 files changed:
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitterTest.java
model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyComparerTest.java
model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyedMapComparerTest.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcConsumerTest.java
plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java
plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java
services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java

index a521272..3192079 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-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.
@@ -21,7 +22,6 @@
 package org.onap.policy.apex.model.policymodel.handling;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -46,19 +46,19 @@ public class ApexPolicyModelTest {
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
-        assertTrue(result.toString().equals(VALID_MODEL_STRING));
+        assertEquals(VALID_MODEL_STRING, result.toString());
     }
 
     @Test
     public void testApexModelVaidateObservation() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelVaidateObservation();
-        assertTrue(result.toString().equals(OBSERVATION_MODEL_STRING));
+        assertEquals(OBSERVATION_MODEL_STRING, result.toString());
     }
 
     @Test
     public void testApexModelVaidateWarning() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelVaidateWarning();
-        assertTrue(result.toString().equals(WARNING_MODEL_STRING));
+        assertEquals(WARNING_MODEL_STRING, result.toString());
     }
 
     @Test
@@ -70,7 +70,7 @@ public class ApexPolicyModelTest {
     @Test
     public void testModelVaidateMalstructured() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelVaidateMalstructured();
-        assertTrue(result.toString().equals(INVALID_MODEL_MALSTRUCTURED_STRING));
+        assertEquals(INVALID_MODEL_MALSTRUCTURED_STRING, result.toString());
     }
 
     @Test
index 046f5af..3ff85c8 100644 (file)
@@ -1,27 +1,28 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-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=========================================================
  */
 
 package org.onap.policy.apex.model.policymodel.handling;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
@@ -34,7 +35,7 @@ public class PolicyAnalyserTest {
         final PolicyAnalyser policyAnalyser = new PolicyAnalyser();
         final PolicyAnalysisResult analysisResult = policyAnalyser.analyse(apexModel);
 
-        assertTrue(analysisResult.toString().equals(EXPECTED_ANALYSIS_RESULT));
+        assertEquals(EXPECTED_ANALYSIS_RESULT, analysisResult.toString());
 
         assertNotNull(analysisResult.getUsedContextAlbums());
         assertNotNull(analysisResult.getUsedContextSchemas());
index f9514ae..f148f7d 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.policy.apex.model.policymodel.handling;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.UUID;
@@ -51,20 +50,20 @@ public class PolicyModelComparerTest {
         resultString = policyModelComparer.asString(false, true);
         checkString = TextFileUtils
                 .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseKeys.txt");
-        assertTrue(resultString.trim().replaceAll("[\\r?\\n]+", " ")
-                .equals(checkString.trim().replaceAll("[\\r?\\n]+", " ")));
+        assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
+                     resultString.trim().replaceAll("[\\r?\\n]+", " "));
 
         resultString = policyModelComparer.asString(true, false);
         checkString = TextFileUtils
                 .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalTerse.txt");
-        assertTrue(resultString.trim().replaceAll("[\\r?\\n]+", " ")
-                .equals(checkString.trim().replaceAll("[\\r?\\n]+", " ")));
+        assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
+                     resultString.trim().replaceAll("[\\r?\\n]+", " "));
 
         resultString = policyModelComparer.asString(true, true);
         checkString = TextFileUtils
                 .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalTerse.txt");
-        assertTrue(resultString.trim().replaceAll("[\\r?\\n]+", " ")
-                .equals(checkString.trim().replaceAll("[\\r?\\n]+", " ")));
+        assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
+                     resultString.trim().replaceAll("[\\r?\\n]+", " "));
 
         final AxKeyInfo leftOnlyKeyInfo = new AxKeyInfo(new AxArtifactKey("LeftOnlyKeyInfo", "0.0.1"),
                 UUID.fromString("ce9168c-e6df-414f-9646-6da464b6f000"), "Left only key info");
@@ -90,20 +89,20 @@ public class PolicyModelComparerTest {
         resultString = policyModelComparer.asString(false, true);
         checkString = TextFileUtils
                 .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt");
-        assertTrue(resultString.trim().replaceAll("[\\r?\\n]+", " ")
-                .equals(checkString.trim().replaceAll("[\\r?\\n]+", " ")));
+        assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
+                     resultString.trim().replaceAll("[\\r?\\n]+", " "));
 
         resultString = policyModelComparer.asString(true, false);
         checkString = TextFileUtils
                 .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt");
-        assertTrue(resultString.trim().replaceAll("[\\r?\\n]+", " ")
-                .equals(checkString.trim().replaceAll("[\\r?\\n]+", " ")));
+        assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
+                     resultString.trim().replaceAll("[\\r?\\n]+", " "));
 
         resultString = policyModelComparer.asString(true, true);
         checkString = TextFileUtils
                 .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt");
-        assertTrue(resultString.trim().replaceAll("[\\r?\\n]+", " ")
-                .equals(checkString.trim().replaceAll("[\\r?\\n]+", " ")));
+        assertEquals(checkString.trim().replaceAll("[\\r?\\n]+", " "),
+                     resultString.trim().replaceAll("[\\r?\\n]+", " "));
 
         assertNotNull(policyModelComparer.getContextAlbumComparisonResult());
         assertNotNull(policyModelComparer.getContextAlbumKeyDifference());
index f8fc99d..902206d 100644 (file)
@@ -22,8 +22,8 @@
 package org.onap.policy.apex.model.policymodel.handling;
 
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.util.Set;
 import java.util.TreeSet;
@@ -49,7 +49,7 @@ public class PolicyModelSplitterTest {
         // not be in the split model
         apexModel.getEvents().getEventMap().remove(new AxArtifactKey("outEvent1", "0.0.1"));
         apexModel.getKeyInformation().getKeyInfoMap().remove(new AxArtifactKey("outEvent1", "0.0.1"));
-        assertTrue(apexModel.equals(splitApexModel));
+        assertEquals(apexModel, splitApexModel);
 
         final Set<AxArtifactKey> requiredMissingPolicySet = new TreeSet<AxArtifactKey>();
         requiredPolicySet.add(new AxArtifactKey("MissingPolicy", "0.0.1"));
@@ -65,7 +65,7 @@ public class PolicyModelSplitterTest {
         // not be in the split model
         apexModel.getEvents().getEventMap().remove(new AxArtifactKey("outEvent1", "0.0.1"));
         apexModel.getKeyInformation().getKeyInfoMap().remove(new AxArtifactKey("outEvent1", "0.0.1"));
-        assertTrue(apexModel.equals(splitApexModel));
+        assertEquals(apexModel, splitApexModel);
 
         // There's only one policy so a split of this model on that policy should return the same
         // model
index 4cf91bd..20780b2 100644 (file)
@@ -21,8 +21,8 @@
 
 package org.onap.policy.apex.model.utilities;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 import org.onap.policy.apex.model.utilities.comparison.KeyComparer;
@@ -40,14 +40,14 @@ public class KeyComparerTest {
         KeyDifference<String> keyDifference = new KeyComparer<String>().compareKeys("Hello", "Goodbye");
 
         assertFalse(keyDifference.isEqual());
-        assertTrue("Hello".equals(keyDifference.getLeftKey().toString()));
-        assertTrue("Goodbye".equals(keyDifference.getRightKey().toString()));
+        assertEquals("Hello", keyDifference.getLeftKey().toString());
+        assertEquals("Goodbye", keyDifference.getRightKey().toString());
 
-        assertTrue("left key Hello and right key Goodbye differ\n".equals(keyDifference.asString(true)));
-        assertTrue("left key Hello and right key Goodbye differ\n".equals(keyDifference.asString(false)));
+        assertEquals("left key Hello and right key Goodbye differ\n", keyDifference.asString(true));
+        assertEquals("left key Hello and right key Goodbye differ\n", keyDifference.asString(false));
 
         KeyDifference<String> keyDifference2 = new KeyComparer<String>().compareKeys("Here", "Here");
-        assertTrue("".equals(keyDifference2.asString(true)));
-        assertTrue("left key Here equals right key Here\n".equals(keyDifference2.asString(false)));
+        assertEquals("", keyDifference2.asString(true));
+        assertEquals("left key Here equals right key Here\n", keyDifference2.asString(false));
     }
 }
index fb993b1..b4e88e2 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.policy.apex.model.utilities;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.util.TreeMap;
 import org.junit.Test;
@@ -58,7 +57,7 @@ public class KeyedMapComparerTest {
         KeyedMapDifference<String, String> kmComparedDiff =
                 new KeyedMapComparer<String, String>().compareMaps(leftMap, rightMap);
 
-        assertTrue(kmComparedSame.getIdenticalValues().equals(leftMap));
+        assertEquals(leftMap, kmComparedSame.getIdenticalValues());
         assertEquals(1, kmComparedDiff.getLeftOnly().size());
         assertEquals(3, kmComparedDiff.getRightOnly().size());
         assertEquals(2, kmComparedDiff.getDifferentValues().size());
index 48fce1b..bd4103f 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.policy.apex.plugins.event.carrier.grpc;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import org.assertj.core.api.Assertions;
 import org.junit.Before;
@@ -80,8 +79,8 @@ public class ApexGrpcConsumerTest {
         grpcConsumer.init(CONSUMER_NAME, consumerParameters, incomingEventReceiver);
         PeeredReference peeredReference = grpcConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR);
         assertNotNull(peeredReference);
-        assertTrue(peeredReference.getPeeredConsumer().equals(grpcConsumer));
-        assertTrue(peeredReference.getPeeredProducer().equals(grpcProducer));
+        assertEquals(grpcConsumer, peeredReference.getPeeredConsumer());
+        assertEquals(grpcProducer, peeredReference.getPeeredProducer());
     }
 
     private EventHandlerParameters populateConsumerParameters(boolean isConsumer, boolean isPeeredMode) {
index 28c198c..caa3bd0 100644 (file)
@@ -21,7 +21,9 @@
 
 package org.onap.policy.apex.plugins.event.protocol.xml;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Date;
@@ -62,14 +64,14 @@ public class XmlEventHandlerTest {
                 logger.debug(apexEvent.toString());
 
                 assertTrue(apexEvent.getName().equals("Event0000") || apexEvent.getName().equals("Event0100"));
-                assertTrue(apexEvent.getVersion().equals("0.0.1"));
-                assertTrue(apexEvent.getNameSpace().equals("org.onap.policy.apex.sample.events"));
-                assertTrue(apexEvent.getSource().equals("test"));
-                assertTrue(apexEvent.getTarget().equals("apex"));
+                assertEquals("0.0.1", apexEvent.getVersion());
+                assertEquals("org.onap.policy.apex.sample.events", apexEvent.getNameSpace());
+                assertEquals("test", apexEvent.getSource());
+                assertEquals("apex", apexEvent.getTarget());
                 assertTrue(apexEvent.get("TestSlogan").toString().startsWith("Test slogan for External Event"));
 
                 final Object testMatchCaseSelected = apexEvent.get("TestMatchCaseSelected");
-                assertTrue(testMatchCaseSelected == null);
+                assertNull(testMatchCaseSelected);
             }
         } catch (final Exception e) {
             e.printStackTrace();
index 5098e93..4f3c68b 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============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.
@@ -23,7 +24,6 @@ package org.onap.policy.apex.plugins.persistence.jpa.eclipselink;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -85,7 +85,7 @@ public class EclipselinkApexDaoTest {
         assertNull(eclipselinkApexDao.getArtifact(ReferenceKeyTestEntity.class, nullRefernceKey));
 
         assertNotNull(eclipselinkApexDao.getAll(null));
-        assertTrue(eclipselinkApexDao.getAll(null).equals(emptyList));
+        assertEquals(emptyList, eclipselinkApexDao.getAll(null));
         assertNotNull(eclipselinkApexDao.getAll(ReferenceKeyTestEntity.class));
     }
 
@@ -233,7 +233,7 @@ public class EclipselinkApexDaoTest {
 
         // test with null class with known key --> return an empty list
         assertNotNull(eclipselinkApexDao.getAll(null, artiKey1));
-        assertTrue(eclipselinkApexDao.getAll(null, artiKey1).equals(Collections.emptyList()));
+        assertEquals(Collections.emptyList(), eclipselinkApexDao.getAll(null, artiKey1));
 
         // test with (not_null) ArtifactKeyTestEntity class
         assertEquals(0, eclipselinkApexDao.getAll(ReferenceKeyTestEntity.class, artiKey0).size());
index 0a34b11..731baf5 100644 (file)
@@ -166,7 +166,7 @@ public class ApexMainTest {
         apexMain.shutdown();
         final String outString = outContent.toString();
         assertTrue(outString.contains("I/O Parameters for id2:v2 has duplicates. So this policy is not executed"));
-        assertTrue(apexMain.getApexParametersMap().size() == 1); // only id1:v1 is kept in the map, id2:v2 failed
+        assertEquals(1, apexMain.getApexParametersMap().size()); // only id1:v1 is kept in the map, id2:v2 failed
     }
 
     @Test
index 43d36f8..927c1c3 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.policy.apex.services.onappf;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.After;
@@ -81,14 +82,14 @@ public class TestApexStarterMain {
     public void testApexStarter_NoArguments() {
         final String[] apexStarterConfigParameters = {};
         apexStarter = new ApexStarterMain(apexStarterConfigParameters);
-        assertTrue(apexStarter.getParameters() == null);
+        assertNull(apexStarter.getParameters());
     }
 
     @Test
     public void testApexStarter_InvalidArguments() {
         final String[] apexStarterConfigParameters = { "src/test/resources/ApexStarterConfigParameters.json" };
         apexStarter = new ApexStarterMain(apexStarterConfigParameters);
-        assertTrue(apexStarter.getParameters() == null);
+        assertNull(apexStarter.getParameters());
     }
 
     @Test
@@ -102,6 +103,6 @@ public class TestApexStarterMain {
         final String[] apexStarterConfigParameters =
         { "-c", "src/test/resources/ApexStarterConfigParameters_InvalidName.json" };
         apexStarter = new ApexStarterMain(apexStarterConfigParameters);
-        assertTrue(apexStarter.getParameters() == null);
+        assertNull(apexStarter.getParameters());
     }
 }
index bf883d7..ba4b225 100644 (file)
@@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.Date;
@@ -194,11 +193,11 @@ public class TestEventInstantiation {
 
         final double temp2 = (double) event.get("TestTemperature");
         assertNotNull(temp2);
-        assertTrue(temp2 == 123.456789);
+        assertEquals(123.456789, temp2, 0);
 
         final Double temp3 = (Double) event.get("TestTemperature");
         assertNotNull(temp3);
-        assertTrue(temp3 == 123.456789);
+        assertEquals(123.456789, temp3, 0);
 
         final Date aDate = new Date(1433453067123L);
         final Map<String, Object> eventDataList = new HashMap<String, Object>();
@@ -223,7 +222,7 @@ public class TestEventInstantiation {
 
         final double temp4 = (double) event.get("TestTemperature");
         assertNotNull(temp4);
-        assertTrue(temp4 == 34.5445667);
+        assertEquals(34.5445667, temp4, 0);
 
         logger.debug(event.toString());
     }
index aaf640b..dc5c06f 100644 (file)
@@ -21,9 +21,9 @@
 
 package org.onap.policy.apex.testsuites.integration.executor.handling;
 
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -89,13 +89,13 @@ public class TestApexModelExport {
         model.getKeyInformation().getKeyInfoMap().remove(new AxArtifactKey("TestContextItem00B", "0.0.1"));
         model.getKeyInformation().getKeyInfoMap().remove(new AxArtifactKey("TestContextItem00C", "0.0.1"));
 
-        assertTrue(model.equals(exportedModel0));
+        assertEquals(model, exportedModel0);
 
         exportPolicyList.remove(0);
 
         final AxPolicyModel exportedModel1 = PolicyModelSplitter.getSubPolicyModel(model, exportPolicyList);
-        assertFalse(model.equals(exportedModel1));
-        assertTrue(model.getPolicies().get("Policy1").equals(exportedModel1.getPolicies().get("Policy1")));
+        assertNotEquals(model, exportedModel1);
+        assertEquals(model.getPolicies().get("Policy1"), exportedModel1.getPolicies().get("Policy1"));
 
         exportPolicyList.clear();
         exportPolicyList.add(new AxArtifactKey("NonExistentPolicy", "0.0.1"));
index 3f38a10..0561162 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-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.
@@ -20,7 +21,7 @@
 
 package org.onap.policy.apex.testsuites.integration.executor.handling;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
@@ -58,7 +59,7 @@ public class TestApexSamplePolicyModel {
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
-        assertTrue(result.toString().equals(VALID_MODEL_STRING));
+        assertEquals(VALID_MODEL_STRING, result.toString());
     }
 
     /**
index d2e35ec..0a4b9a7 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 2019-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.
@@ -24,7 +24,6 @@ package org.onap.policy.apex.testsuites.integration.executor.handling;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import org.junit.After;
@@ -67,12 +66,12 @@ public class TestContextUpdateDifferentModels {
     @Before
     public void beforeTest() {
         schemaParameters = new SchemaParameters();
-        
+
         schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
         schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
 
         ParameterService.register(schemaParameters);
-        
+
         contextParameters = new ContextParameters();
 
         contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -84,7 +83,7 @@ public class TestContextUpdateDifferentModels {
         ParameterService.register(contextParameters.getDistributorParameters());
         ParameterService.register(contextParameters.getLockManagerParameters());
         ParameterService.register(contextParameters.getPersistorParameters());
-        
+
         engineParameters = new EngineParameters();
         engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters());
         ParameterService.register(engineParameters);
@@ -96,7 +95,7 @@ public class TestContextUpdateDifferentModels {
     @After
     public void afterTest() {
         ParameterService.deregister(engineParameters);
-        
+
         ParameterService.deregister(contextParameters.getDistributorParameters());
         ParameterService.deregister(contextParameters.getLockManagerParameters());
         ParameterService.deregister(contextParameters.getPersistorParameters());
@@ -136,16 +135,16 @@ public class TestContextUpdateDifferentModels {
         assertEquals(apexEngine.getInternalContext().getContextAlbums().size(),
                 apexModelSample.getAlbums().getAlbumsMap().size());
         for (final ContextAlbum contextAlbum : apexEngine.getInternalContext().getContextAlbums().values()) {
-            assertTrue(
-                    contextAlbum.getAlbumDefinition().equals(apexModelSample.getAlbums().get(contextAlbum.getKey())));
+            assertEquals(
+                    contextAlbum.getAlbumDefinition(), apexModelSample.getAlbums().get(contextAlbum.getKey()));
         }
 
         apexEngine.updateModel(someSpuriousModel, false);
         assertEquals(apexEngine.getInternalContext().getContextAlbums().size(),
                 someSpuriousModel.getAlbums().getAlbumsMap().size());
         for (final ContextAlbum contextAlbum : apexEngine.getInternalContext().getContextAlbums().values()) {
-            assertTrue(
-                    contextAlbum.getAlbumDefinition().equals(someSpuriousModel.getAlbums().get(contextAlbum.getKey())));
+            assertEquals(
+                    contextAlbum.getAlbumDefinition(), someSpuriousModel.getAlbums().get(contextAlbum.getKey()));
         }
 
         apexEngine.clear();
index fdc60d7..22303a6 100644 (file)
@@ -369,9 +369,9 @@ public class ApexServiceModelUpdateTest {
         private void checkResult(final ApexEvent result) {
             assertTrue(result.getName().startsWith("Event0004") || result.getName().startsWith("Event0104"));
 
-            assertTrue(result.get("TestSlogan").equals("This is a test slogan"));
-            assertTrue(result.get("TestMatchCase").equals((byte) 123));
-            assertTrue(result.get("TestTemperature").equals(34.5445667));
+            assertEquals("This is a test slogan", result.get("TestSlogan"));
+            assertEquals((byte) 123, result.get("TestMatchCase"));
+            assertEquals(34.5445667, result.get("TestTemperature"));
             assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0
                     && ((byte) result.get("TestMatchCaseSelected") <= 3));
             assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0
index 72444cc..445c2df 100644 (file)
@@ -499,9 +499,9 @@ public class ApexServiceTest {
         private void checkResult(final ApexEvent result) {
             assertTrue(result.getName().startsWith("Event0004") || result.getName().startsWith("Event0104"));
 
-            assertTrue(result.get("TestSlogan").equals("This is a test slogan"));
-            assertTrue(result.get("TestMatchCase").equals((byte) 123));
-            assertTrue(result.get("TestTemperature").equals(34.5445667));
+            assertEquals("This is a test slogan", result.get("TestSlogan"));
+            assertEquals((byte) 123, result.get("TestMatchCase"));
+            assertEquals(34.5445667, result.get("TestTemperature"));
             assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0
                     && ((byte) result.get("TestMatchCaseSelected") <= 3));
             assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0