summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-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
6 files changed, 34 insertions, 35 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());