aboutsummaryrefslogtreecommitdiffstats
path: root/model/basic-model/src/test/java/org
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-12 23:29:25 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-12 23:54:51 +0100
commit0e23f7634e1e1fb31454c516974613335fcea1a4 (patch)
treebedf0e52104e62599dd091eb6292de5dc7d57f49 /model/basic-model/src/test/java/org
parent3ccc3d9ecd4bcd8960a2da6ecbdc7f3ac806fc67 (diff)
Sonar/Checkstyle in model/context/core
Checkstyle and sonar changes in the model, contexot and core modules. Issue-ID: POLICY-1034 Change-Id: I2d40bc877f3a548844470fc290fc89d63fa465ae Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'model/basic-model/src/test/java/org')
-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());
}
}