#39 The supplied Input unnecessarily is not written into memory

This commit is contained in:
Andreas Penski 2019-12-18 15:57:44 +01:00
parent d7ee019194
commit efd4fd5fff
63 changed files with 1111 additions and 18196 deletions

View file

@ -31,6 +31,8 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import de.kosit.validationtool.impl.Helper.Invalid;
import de.kosit.validationtool.impl.Helper.Simple;
import de.kosit.validationtool.model.scenarios.Scenarios;
/**
@ -40,12 +42,6 @@ import de.kosit.validationtool.model.scenarios.Scenarios;
*/
public class ConversionServiceTest {
private static final URL VALID_XML = ConversionServiceTest.class.getResource("/valid/scenarios.xml");
private static final URL INVALID_XML = ConversionServiceTest.class.getResource("/invalid/scenarios-invalid.xml");
private static final URL ILLFORMED_XML = ConversionServiceTest.class.getResource("/invalid/scenarios-illformed.xml");
private static final URL SCHEMA = ConversionServiceTest.class.getResource("/xsd/scenarios.xsd");
@Rule
@ -77,28 +73,28 @@ public class ConversionServiceTest {
@Test
public void testUnmarshal() throws URISyntaxException {
final Scenarios s = this.service.readXml(VALID_XML.toURI(), Scenarios.class);
final Scenarios s = this.service.readXml(Simple.SCENARIOS, Scenarios.class);
assertThat(s).isNotNull();
assertThat(s.getName()).isEqualToIgnoringCase("XInneres");
assertThat(s.getName()).isEqualToIgnoringCase("HTML-TestSuite");
}
@Test
public void testUnmarshalWithSchema() throws URISyntaxException {
final Scenarios s = this.service.readXml(VALID_XML.toURI(), Scenarios.class, ContentRepository.createSchema(SCHEMA));
public void testUnmarshalWithSchema() {
final Scenarios s = this.service.readXml(Simple.SCENARIOS, Scenarios.class, ContentRepository.createSchema(SCHEMA));
assertThat(s).isNotNull();
assertThat(s.getName()).isEqualToIgnoringCase("XInneres");
assertThat(s.getName()).isEqualToIgnoringCase("HTML-TestSuite");
}
@Test
public void testUnmarshalInvalidXml() throws URISyntaxException {
public void testUnmarshalInvalidXml() {
this.exception.expect(ConversionService.ConversionExeption.class);
this.service.readXml(INVALID_XML.toURI(), Scenarios.class, ContentRepository.createSchema(SCHEMA));
this.service.readXml(Invalid.SCENARIOS, Scenarios.class, ContentRepository.createSchema(SCHEMA));
}
@Test
public void testUnmarshalIllFormed() throws URISyntaxException {
public void testUnmarshalIllFormed() {
this.exception.expect(ConversionService.ConversionExeption.class);
this.service.readXml(ILLFORMED_XML.toURI(), Scenarios.class, ContentRepository.createSchema(SCHEMA));
this.service.readXml(Invalid.SCENARIOS_ILLFORMED, Scenarios.class, ContentRepository.createSchema(SCHEMA));
}
@Test
@ -110,13 +106,13 @@ public class ConversionServiceTest {
@Test
public void testUnmarshalUnknownType() throws URISyntaxException {
this.exception.expect(ConversionService.ConversionExeption.class);
this.service.readXml(VALID_XML.toURI(), ConversionService.class);
this.service.readXml(Simple.SCENARIOS, ConversionService.class);
}
@Test
public void testUnmarshalWithoutType() throws URISyntaxException {
this.exception.expect(ConversionService.ConversionExeption.class);
this.service.readXml(VALID_XML.toURI(), null);
this.service.readXml(Simple.SCENARIOS, null);
}
}