mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
(chore) Integration Testing acceptMatch functionality
This commit is contained in:
parent
65ed945602
commit
245d7d4cac
6 changed files with 30 additions and 6 deletions
|
|
@ -138,7 +138,7 @@ public class CommandlineApplicationTest {
|
||||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r",
|
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r",
|
||||||
Paths.get(Simple.REPOSITORY).toString(), Paths.get(Simple.EXAMPLES).toString() };
|
Paths.get(Simple.REPOSITORY).toString(), Paths.get(Simple.EXAMPLES).toString() };
|
||||||
CommandLineApplication.mainProgram(args);
|
CommandLineApplication.mainProgram(args);
|
||||||
assertThat(this.commandLine.getErrorOutput()).contains("Processing 5 object(s) completed");
|
assertThat(this.commandLine.getErrorOutput()).contains("Processing 6 object(s) completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ package de.kosit.validationtool.impl;
|
||||||
import static de.kosit.validationtool.api.InputFactory.read;
|
import static de.kosit.validationtool.api.InputFactory.read;
|
||||||
import static de.kosit.validationtool.impl.Helper.Simple.GARBAGE;
|
import static de.kosit.validationtool.impl.Helper.Simple.GARBAGE;
|
||||||
import static de.kosit.validationtool.impl.Helper.Simple.NOT_WELLFORMED;
|
import static de.kosit.validationtool.impl.Helper.Simple.NOT_WELLFORMED;
|
||||||
|
import static de.kosit.validationtool.impl.Helper.Simple.REJECTED;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
@ -54,7 +54,7 @@ public class DefaultCheckTest {
|
||||||
private DefaultCheck implementation;
|
private DefaultCheck implementation;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() throws URISyntaxException {
|
public void setup() {
|
||||||
final CheckConfiguration d = new CheckConfiguration(Simple.SCENARIOS);
|
final CheckConfiguration d = new CheckConfiguration(Simple.SCENARIOS);
|
||||||
d.setScenarioRepository(new File(Simple.REPOSITORY).toURI());
|
d.setScenarioRepository(new File(Simple.REPOSITORY).toURI());
|
||||||
this.implementation = new DefaultCheck(d);
|
this.implementation = new DefaultCheck(d);
|
||||||
|
|
@ -130,7 +130,19 @@ public class DefaultCheckTest {
|
||||||
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
|
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
|
||||||
assertThat(result.getReport()).isNotNull();
|
assertThat(result.getReport()).isNotNull();
|
||||||
assertThat(result.getReportDocument()).isNotNull();
|
assertThat(result.getReportDocument()).isNotNull();
|
||||||
System.out.println(Helper.serialize(result.getReportDocument()));
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRejectAcceptMatch() {
|
||||||
|
final Result result = this.implementation.checkInput(read(REJECTED));
|
||||||
|
assertThat(result).isNotNull();
|
||||||
|
assertThat(result.isWellformed()).isTrue();
|
||||||
|
assertThat(result.isSchemaValid()).isTrue();
|
||||||
|
assertThat(result.isProcessingSuccessful()).isTrue();
|
||||||
|
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
|
||||||
|
assertThat(result.isAcceptable()).isFalse();
|
||||||
|
assertThat(result.getReport()).isNotNull();
|
||||||
|
assertThat(result.getReportDocument()).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ public class Helper {
|
||||||
|
|
||||||
public static final URI FOO = Simple.ROOT.resolve("input/foo.xml");
|
public static final URI FOO = Simple.ROOT.resolve("input/foo.xml");
|
||||||
|
|
||||||
|
public static final URI REJECTED = Simple.ROOT.resolve("input/withManualReject.xml");
|
||||||
|
|
||||||
public static final URI SCENARIOS = ROOT.resolve("scenarios.xml");
|
public static final URI SCENARIOS = ROOT.resolve("scenarios.xml");
|
||||||
|
|
||||||
public static final URI REPOSITORY = ROOT.resolve("repository/");
|
public static final URI REPOSITORY = ROOT.resolve("repository/");
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,7 @@
|
||||||
|
|
||||||
<foo xmlns="http://validator.kosit.de/test-sample">
|
<foo xmlns="http://validator.kosit.de/test-sample">
|
||||||
<inner>asldkfj</inner>
|
<inner>asldkfj</inner>
|
||||||
<content></content>
|
<content>
|
||||||
|
<rejected/>
|
||||||
|
</content>
|
||||||
</foo>
|
</foo>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<simple xmlns="http://validator.kosit.de/test-sample">
|
||||||
|
<inner>asldkfj</inner>
|
||||||
|
<content>
|
||||||
|
<rejected>directly transferred, so this is part of the report</rejected>
|
||||||
|
</content>
|
||||||
|
</simple>
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
<location>report.xsl</location>
|
<location>report.xsl</location>
|
||||||
</resource>
|
</resource>
|
||||||
</createReport>
|
</createReport>
|
||||||
<acceptMatch>count(//cri:xmlSyntaxError) = 0</acceptMatch>
|
<acceptMatch>count(//test:rejected) = 0</acceptMatch>
|
||||||
</scenario>
|
</scenario>
|
||||||
|
|
||||||
<scenario>
|
<scenario>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue