Skip to content
Snippets Groups Projects
Commit 07dbc29c authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- fixed order of assertions

parent c96a1f1e
Branches
Tags
No related merge requests found
...@@ -82,23 +82,38 @@ public class TestXmlFormatValidationPlugin { ...@@ -82,23 +82,38 @@ public class TestXmlFormatValidationPlugin {
for (Path path : validPaths) { for (Path path : validPaths) {
System.out.println("= should be valid ===== " + path.toString()); System.out.println("= should be valid ===== " + path.toString());
assertTrue("validateFormat (pass), check if " + path + " exist", Files.exists(path)); assertTrue("validateFormat (pass), check if " + path + " exist", Files.exists(path));
mock.validateFormat(path.toString()); var has_exception = false;
assertTrue("validateFormat(" + path + "), returns valid?", mock.validateFormat(path.toString())); var is_valid = false;
assertTrue("validateFormat(" + path + "), is wellformed?", mock.isWellFormed()); try {
//System.out.println("ERRORS:" + mock.getErrors()); is_valid = mock.validateFormat(path.toString());
} catch (Exception e) {
System.out.println( "EXCEPTION:" + e.getMessage());
e.printStackTrace();
has_exception = true;
}
assertTrue("validateFormat(" + path + "), reports no errors?", mock.getErrors().isEmpty()); assertTrue("validateFormat(" + path + "), reports no errors?", mock.getErrors().isEmpty());
assertFalse("validateformat(" + path + "), has no exception", has_exception);
assertTrue("validateFormat(" + path + "), is wellformed?", mock.isWellFormed());
assertTrue("validateFormat(" + path + "), returns valid?", is_valid);
assertNotNull("getValidationDetails(), " + path + ", not null", mock.getValidationDetails()); assertNotNull("getValidationDetails(), " + path + ", not null", mock.getValidationDetails());
assertTrue("validateFormat(" + path + "), is valid?", mock.isValid()); assertTrue("validateFormat(" + path + "), is valid?", mock.isValid());
} }
for (Path path : invalidPaths) { for (Path path : invalidPaths) {
System.out.println("= should be invalid === " + path.toString()); System.out.println("= should be invalid === " + path.toString());
assertTrue("validateFormat (pass), check if " + path + " exist", Files.exists(path)); assertTrue("validateFormat (pass), check if " + path + " exist", Files.exists(path));
//mock.validateFormat(path.toString()); var has_exception = false;
assertFalse("validateFormat(" + path + "), returns invalid?", mock.validateFormat(path.toString())); var is_valid = true; // true to show if flipped
try {
is_valid= mock.validateFormat(path.toString());
} catch (Exception e) {
System.out.println( "EXCEPTION:" + e.getMessage());
e.printStackTrace();
has_exception = true;
}
assertFalse("validateformat(" + path + "), has no exception", has_exception);
assertTrue("validateFormat(" + path + "), is wellformed?", mock.isWellFormed()); assertTrue("validateFormat(" + path + "), is wellformed?", mock.isWellFormed());
//System.out.println("ERRORS:" + mock.getErrors()); assertFalse("validateFormat(" + path + "), returns invalid?", is_valid);
assertFalse("validateFormat(" + path + "), reports errors?", mock.getErrors().isEmpty()); assertFalse("validateFormat(" + path + "), reports errors?", mock.getErrors().isEmpty());
assertNotNull("getValidationDetails(), " + path + ", not null", mock.getValidationDetails()); assertNotNull("getValidationDetails(), " + path + ", not null", mock.getValidationDetails());
assertFalse("validateFormat(" + path + "), is invalid?", mock.isValid()); assertFalse("validateFormat(" + path + "), is invalid?", mock.isValid());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment