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

- splitted tests in valid/invalid testfiles

parent 32160033
No related branches found
No related tags found
No related merge requests found
Pipeline #4261 failed
......@@ -7,6 +7,7 @@ import org.junit.runners.JUnit4;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
......@@ -37,7 +38,7 @@ public class TestSLUBXmlFormatValidationPlugin {
mock = new SLUBXmlFormatValidationPlugin();
initp.put("catalog", "/etc/xml/catalog");
initp.put("schemacatalog", "example_catalog/schema_catalog.xml");
//initp.put("debug", "true");
initp.put("debug", "true");
mock.initParams(initp);
}
......@@ -52,10 +53,16 @@ public class TestSLUBXmlFormatValidationPlugin {
@org.junit.Test
public void validateFormat() {
System.out.println();
for (Path path : testPaths) {
System.out.println("====== " + path.toString());
Path[] validPaths = Arrays.stream(testPaths)
.filter( f -> f.toString().contains("/valid/") )
.toArray(Path[]::new);
Path[] invalidPaths = Arrays.stream(testPaths)
.filter( f -> f.toString().contains("/invalid/") )
.toArray(Path[]::new);
for (Path path : validPaths) {
System.out.println("= should be valid ===== " + path.toString());
assertTrue("validateFormat (pass), check if " + path + " exist", Files.exists(path));
//mock.validateFormat(path.toString());
mock.validateFormat(path.toString());
assertTrue("validateFormat(" + path + "), returns valid?", mock.validateFormat(path.toString()));
assertTrue("validateFormat(" + path + "), is wellformed?", mock.isWellFormed());
//System.out.println("ERRORS:" + mock.getErrors());
......@@ -63,6 +70,17 @@ public class TestSLUBXmlFormatValidationPlugin {
assertNotNull("getValidationDetails(), " + path + ", not null", mock.getValidationDetails());
assertTrue("validateFormat(" + path + "), is valid?", mock.isValid());
}
for (Path path : invalidPaths) {
System.out.println("= should be invalid === " + path.toString());
assertTrue("validateFormat (pass), check if " + path + " exist", Files.exists(path));
//mock.validateFormat(path.toString());
assertFalse("validateFormat(" + path + "), returns invalid?", mock.validateFormat(path.toString()));
assertTrue("validateFormat(" + path + "), is wellformed?", mock.isWellFormed());
//System.out.println("ERRORS:" + mock.getErrors());
assertFalse("validateFormat(" + path + "), reports errors?", mock.getErrors().isEmpty());
assertNotNull("getValidationDetails(), " + path + ", not null", mock.getValidationDetails());
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