summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java12
-rw-r--r--model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java12
-rw-r--r--model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java12
-rw-r--r--model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java16
4 files changed, 36 insertions, 16 deletions
diff --git a/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java b/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java
index 8c1f756c1..b5028273c 100644
--- a/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java
+++ b/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java
@@ -54,7 +54,7 @@ class SupportApexBasicModelTest {
@Test
void testModelValid() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValid();
- var expectedResult = ResourceUtils.getResourceAsString(VALID_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(VALID_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@@ -67,21 +67,21 @@ class SupportApexBasicModelTest {
@Test
void testApexModelValidateWarning() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateWarning();
- var expectedResult = ResourceUtils.getResourceAsString(WARNING_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testModelValidateInvalidModel() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateInvalidModel();
- var expectedResult = ResourceUtils.getResourceAsString(INVALID_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testModelValidateMalstructured() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateMalstructured();
- var expectedResult = ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING));
assertEquals(expectedResult, result.toString());
}
@@ -89,4 +89,8 @@ class SupportApexBasicModelTest {
void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+
+ private String normalizeNewlines(String input) {
+ return input.replace("\r\n", "\n");
+ }
}
diff --git a/model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java b/model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
index a9cb16914..31083d4c4 100644
--- a/model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
+++ b/model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
@@ -68,28 +68,28 @@ class ApexContextModelTest {
@Test
void testApexModelValidateObservation() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateObservation();
- var expectedResult = ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testApexModelValidateWarning() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateWarning();
- var expectedResult = ResourceUtils.getResourceAsString(WARNING_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testModelValidateInvalidModel() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateInvalidModel();
- var expectedResult = ResourceUtils.getResourceAsString(INVALID_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testModelValidateMalstructured() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateMalstructured();
- var expectedResult = ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING));
assertEquals(expectedResult, result.toString());
}
@@ -97,4 +97,8 @@ class ApexContextModelTest {
void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+
+ private String normalizeNewlines(String input) {
+ return input.replace("\r\n", "\n");
+ }
}
diff --git a/model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java b/model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
index df1857c82..bb50fb35e 100644
--- a/model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
+++ b/model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
@@ -64,28 +64,28 @@ class ApexEventModelTest {
@Test
void testApexModelValidateObservation() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateObservation();
- String expected = ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING);
+ var expected = normalizeNewlines(ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING));
assertEquals(expected, result.toString());
}
@Test
void testApexModelValidateWarning() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateWarning();
- String expected = ResourceUtils.getResourceAsString(WARNING_MODEL_STRING);
+ var expected = normalizeNewlines(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING));
assertEquals(expected, result.toString());
}
@Test
void testModelValidateInvalidModel() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateInvalidModel();
- String expected = ResourceUtils.getResourceAsString(INVALID_MODEL_STRING);
+ var expected = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING));
assertEquals(expected, result.toString());
}
@Test
void testModelValidateMalstructured() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateMalstructured();
- String expected = ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING);
+ var expected = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING));
assertEquals(expected, result.toString());
}
@@ -93,4 +93,8 @@ class ApexEventModelTest {
void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+
+ private String normalizeNewlines(String input) {
+ return input.replace("\r\n", "\n");
+ }
}
diff --git a/model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java b/model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
index 01f7062e1..c943befd5 100644
--- a/model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
+++ b/model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
@@ -61,29 +61,37 @@ class ApexPolicyModelTest {
@Test
void testApexModelValidateObservation() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateObservation();
- assertEquals(ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING), result.toString());
+ var expectedOutput = normalizeNewlines(ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING));
+ assertEquals(expectedOutput, result.toString());
}
@Test
void testApexModelValidateWarning() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateWarning();
- assertEquals(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING), result.toString());
+ var expectedOutput = normalizeNewlines(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING));
+ assertEquals(expectedOutput, result.toString());
}
@Test
void testModelValidateInvalidModel() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateInvalidModel();
- assertEquals(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING), result.toString());
+ var expectedOutput = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING));
+ assertEquals(expectedOutput, result.toString());
}
@Test
void testModelValidateMalstructured() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateMalstructured();
- assertEquals(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING), result.toString());
+ var expectedOutput = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING));
+ assertEquals(expectedOutput, result.toString());
}
@Test
void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+
+ private String normalizeNewlines(String input) {
+ return input.replace("\r\n", "\n");
+ }
}