summaryrefslogtreecommitdiffstats
path: root/model/basic-model/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'model/basic-model/src/test/java')
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java4
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java25
2 files changed, 13 insertions, 16 deletions
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
index 9ced9d84b..905f9e16b 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
@@ -73,13 +73,13 @@ public class TestBasicModelTest {
testApexModel.testApexModelVaidateInvalidModel();
fail("Test should throw an exception");
} catch (final Exception e) {
- assertEquals("should not be valid ***validation of model successful***", e.getMessage());
+ assertEquals("model should not be valid ***validation of model successful***", e.getMessage());
}
try {
testApexModel.testApexModelVaidateMalstructured();
fail("Test should throw an exception");
} catch (final Exception e) {
- assertEquals("should not be valid ***validation of model successful***", e.getMessage());
+ assertEquals("model should not be valid ***validation of model successful***", e.getMessage());
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
index 648194a52..57c30db11 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
@@ -38,57 +38,54 @@ public class TestModelWriter {
@Test
public void testModelWriter() throws IOException, ApexException {
ApexModelWriter<AxModel> modelWriter = new ApexModelWriter<AxModel>(AxModel.class);
-
+
modelWriter.setValidateFlag(true);
assertTrue(modelWriter.getValidateFlag());
assertEquals(0, modelWriter.getCDataFieldSet().size());
-
+
assertFalse(modelWriter.isJsonOutput());
modelWriter.setJsonOutput(true);
assertTrue(modelWriter.isJsonOutput());
modelWriter.setJsonOutput(false);
assertFalse(modelWriter.isJsonOutput());
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
AxModel model = new TestApexBasicModelCreator().getModel();
-
+
modelWriter.write(model, baos);
modelWriter.setJsonOutput(true);
modelWriter.write(model, baos);
modelWriter.setJsonOutput(false);
-
+
modelWriter.setValidateFlag(false);
modelWriter.write(model, baos);
modelWriter.setJsonOutput(true);
modelWriter.write(model, baos);
modelWriter.setJsonOutput(false);
-
+
modelWriter.setValidateFlag(true);
model.getKeyInformation().getKeyInfoMap().clear();
try {
modelWriter.write(model, baos);
fail("Test should throw an exception here");
- }
- catch (Exception e) {
- assertEquals("Apex concept xml (BasicModel:0.0.1) validation failed", e.getMessage());
+ } catch (Exception e) {
+ assertEquals("Apex concept xml (BasicModel:0.0.1) validation failed", e.getMessage().substring(0, 53));
}
model.getKeyInformation().generateKeyInfo(model);
try {
modelWriter.write(null, baos);
fail("Test should throw an exception here");
- }
- catch (Exception e) {
+ } catch (Exception e) {
assertEquals("concept may not be null", e.getMessage());
}
-
+
try {
ByteArrayOutputStream nullBaos = null;
modelWriter.write(model, nullBaos);
fail("Test should throw an exception here");
- }
- catch (Exception e) {
+ } catch (Exception e) {
assertEquals("concept stream may not be null", e.getMessage());
}
}