aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2020-07-22 14:26:19 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-22 14:26:19 +0000
commit67ee67bd0da0d2d16abb982e26a3d48ba031a7e8 (patch)
tree8ab86bc510a96ae4219581e5a7213defecbe1266
parentd19067ce13765b7f98bcefb26b1bb469282c6624 (diff)
parent53b9324d6ec14ef75dc1f943c19b3ea1a46bc8ab (diff)
Merge "Fix assertTrue in apex-pdp/model apex-pdp/plugins, apex-pdp/services and apex-pdp/testsuites"
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java10
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java11
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java25
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitterTest.java6
-rw-r--r--model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyComparerTest.java14
-rw-r--r--model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyedMapComparerTest.java3
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcConsumerTest.java5
-rw-r--r--plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java12
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java6
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java2
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java7
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java7
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java10
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java5
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java19
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java6
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java6
17 files changed, 77 insertions, 77 deletions
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
index a521272ae..3192079d7 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
@@ -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
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java
index 046f5af22..3ff85c898 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java
@@ -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());
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
index f9514ae5b..f148f7d2a 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
@@ -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());
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitterTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitterTest.java
index f8fc99dd8..902206d51 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitterTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelSplitterTest.java
@@ -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
diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyComparerTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyComparerTest.java
index 4cf91bd39..20780b271 100644
--- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyComparerTest.java
+++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyComparerTest.java
@@ -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));
}
}
diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyedMapComparerTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyedMapComparerTest.java
index fb993b10f..b4e88e20d 100644
--- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyedMapComparerTest.java
+++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/KeyedMapComparerTest.java
@@ -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());
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcConsumerTest.java
index 48fce1bee..bd4103f92 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcConsumerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcConsumerTest.java
@@ -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) {
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java
index 28c198cd8..caa3bd06f 100644
--- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java
+++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java
@@ -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();
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java
index 5098e9301..4f3c68b0f 100644
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java
+++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java
@@ -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());
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
index 0a34b1164..731baf5ef 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
@@ -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
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
index 43d36f84d..927c1c3f3 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
@@ -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());
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
index bf883d761..ba4b225d2 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
@@ -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());
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
index aaf640bb4..dc5c06f85 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
@@ -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"));
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
index 3f38a10dd..0561162c8 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
@@ -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());
}
/**
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
index d2e35ecb2..0a4b9a7d5 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
@@ -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();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
index fdc60d765..22303a69a 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
@@ -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
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
index 72444cc7c..445c2df1f 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
@@ -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