mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
#41 fix validation of garbage e.g. non xml files
This commit is contained in:
parent
2d85fccd95
commit
fa5966d464
17 changed files with 134 additions and 62 deletions
|
|
@ -20,6 +20,7 @@
|
|||
package de.kosit.validationtool.impl;
|
||||
|
||||
import static de.kosit.validationtool.api.InputFactory.read;
|
||||
import static de.kosit.validationtool.impl.Helper.Simple.GARBAGE;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -103,4 +104,13 @@ public class DefaultCheckTest {
|
|||
assertThat(doc.extractHtml()).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGarbage() {
|
||||
final Result result = this.implementation.checkInput(read(GARBAGE));
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.isWellformed()).isFalse();
|
||||
assertThat(result.isSchemaValid()).isFalse();
|
||||
assertThat(result.isProcessingSuccessful()).isFalse();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ public class Helper {
|
|||
public static final URI INVALID = ROOT.resolve("input/simple-invalid.xml");
|
||||
|
||||
public static final URI UNKNOWN = ROOT.resolve("input/unknown.xml");
|
||||
|
||||
public static final URI GARBAGE = ROOT.resolve("input/no-xml.file");
|
||||
}
|
||||
|
||||
public static final URI SOURCE_ROOT = Paths.get("src/main/resources").toUri();
|
||||
|
|
|
|||
1
src/test/resources/examples/simple/input/no-xml.file
Normal file
1
src/test/resources/examples/simple/input/no-xml.file
Normal file
|
|
@ -0,0 +1 @@
|
|||
some binary stuff
|
||||
Loading…
Add table
Add a link
Reference in a new issue