(chore) reduce test objects, reuse simple stuff

This commit is contained in:
Andreas Penski (init) 2020-03-23 13:31:06 +01:00
parent 245d7d4cac
commit 982b8fd79f
2 changed files with 14 additions and 344 deletions

View file

@ -22,7 +22,7 @@ package de.kosit.validationtool.cmd;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
import org.junit.After;
import org.junit.Before;
@ -30,6 +30,7 @@ import org.junit.Test;
import de.kosit.validationtool.api.InputFactory;
import de.kosit.validationtool.impl.Helper;
import de.kosit.validationtool.impl.Helper.Simple;
import de.kosit.validationtool.impl.tasks.CheckAction;
/**
@ -37,7 +38,6 @@ import de.kosit.validationtool.impl.tasks.CheckAction;
*/
public class PrintReportActionTest {
private static final URL REPORT = SerializeReportActionTest.class.getResource("/examples/results/report.xml");
private CommandLine commandLine;
@ -45,26 +45,26 @@ public class PrintReportActionTest {
@Before
public void setup() throws IOException {
commandLine = new CommandLine();
commandLine.activate();
action = new PrintReportAction();
this.commandLine = new CommandLine();
this.commandLine.activate();
this.action = new PrintReportAction();
}
@After
public void tearDownd() throws IOException {
commandLine.deactivate();
this.commandLine.deactivate();
}
@Test
public void testSimpleSerialize() {
CheckAction.Bag b = new CheckAction.Bag(InputFactory.read(REPORT));
b.setReport(Helper.load(REPORT));
assertThat(action.isSkipped(b)).isFalse();
action.check(b);
public void testSimpleSerialize() throws MalformedURLException {
final CheckAction.Bag b = new CheckAction.Bag(InputFactory.read(Simple.SIMPLE_VALID));
b.setReport(Helper.load(Simple.SIMPLE_VALID.toURL()));
assertThat(this.action.isSkipped(b)).isFalse();
this.action.check(b);
assertThat(b.isStopped()).isFalse();
assertThat(commandLine.getOutput()).isNotEmpty();
// assertThat(commandLine.getOutput()).contains("<?xml version=\"1.0\" ");
// assertThat(commandLine.getErrorOutput()).isEmpty();
assertThat(this.commandLine.getOutput()).isNotEmpty();
assertThat(this.commandLine.getOutput()).contains("<?xml version=\"1.0\" ");
assertThat(this.commandLine.getErrorOutput()).isEmpty();
}
}