mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
some more tests
This commit is contained in:
parent
46ddea57d6
commit
2c479eded5
8 changed files with 197 additions and 30 deletions
|
|
@ -72,6 +72,10 @@ public class CreateReportAction implements CheckAction {
|
||||||
*/
|
*/
|
||||||
private static class ReaderWrapper implements XMLReader {
|
private static class ReaderWrapper implements XMLReader {
|
||||||
|
|
||||||
|
private static final String SAX_FEATURES_NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
|
||||||
|
|
||||||
|
private static final String SAX_FEATURES_NAMESPACES = "http://xml.org/sax/features/namespaces";
|
||||||
|
|
||||||
private final XMLReader delegate;
|
private final XMLReader delegate;
|
||||||
|
|
||||||
public ReaderWrapper(final XMLReader xmlReader) {
|
public ReaderWrapper(final XMLReader xmlReader) {
|
||||||
|
|
@ -80,9 +84,9 @@ public class CreateReportAction implements CheckAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getFeature(final String name) throws SAXNotRecognizedException, SAXNotSupportedException {
|
public boolean getFeature(final String name) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||||
if (name.equals("http://xml.org/sax/features/namespaces")) {
|
if (SAX_FEATURES_NAMESPACES.equals(name)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (name.equals("http://xml.org/sax/features/namespace-prefixes")) {
|
} else if (SAX_FEATURES_NAMESPACE_PREFIXES.equals(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// just return false on unknown properties
|
// just return false on unknown properties
|
||||||
|
|
@ -92,10 +96,10 @@ public class CreateReportAction implements CheckAction {
|
||||||
@Override
|
@Override
|
||||||
public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
|
public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||||
// this inverts the logic from JaxbSource pseude parser
|
// this inverts the logic from JaxbSource pseude parser
|
||||||
if (name.equals("http://xml.org/sax/features/namespaces") && !value) {
|
if (name.equals(SAX_FEATURES_NAMESPACES) && !value) {
|
||||||
throw new SAXNotRecognizedException(name);
|
throw new SAXNotRecognizedException(name);
|
||||||
}
|
}
|
||||||
if (name.equals("http://xml.org/sax/features/namespace-prefixes") && value) {
|
if (name.equals(SAX_FEATURES_NAMESPACE_PREFIXES) && value) {
|
||||||
throw new SAXNotRecognizedException(name);
|
throw new SAXNotRecognizedException(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package de.kosit.validationtool.config;
|
package de.kosit.validationtool.config;
|
||||||
|
|
||||||
import static de.kosit.validationtool.config.SimpleConfigTest.createScenarioConfiguration;
|
import static de.kosit.validationtool.config.TestScenarioFactory.createScenario;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -33,14 +33,14 @@ public class ScenarioBuilderTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void simpleValid() {
|
public void simpleValid() {
|
||||||
final Result<Scenario, String> result = createScenarioConfiguration().build(Simple.createContentRepository());
|
final Result<Scenario, String> result = createScenario().build(Simple.createContentRepository());
|
||||||
assertThat(result.isValid()).isTrue();
|
assertThat(result.isValid()).isTrue();
|
||||||
assertThat(result.getObject().getConfiguration()).isNotNull();
|
assertThat(result.getObject().getConfiguration()).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoSchema() {
|
public void testNoSchema() {
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.validate((SchemaBuilder) null);
|
builder.validate((SchemaBuilder) null);
|
||||||
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
||||||
assertThat(result.isValid()).isFalse();
|
assertThat(result.isValid()).isFalse();
|
||||||
|
|
@ -49,7 +49,7 @@ public class ScenarioBuilderTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoMatch() {
|
public void testNoMatch() {
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.match((String) null);
|
builder.match((String) null);
|
||||||
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
||||||
assertThat(result.isValid()).isFalse();
|
assertThat(result.isValid()).isFalse();
|
||||||
|
|
@ -58,7 +58,7 @@ public class ScenarioBuilderTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidMatch() {
|
public void testInvalidMatch() {
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.match("/////");
|
builder.match("/////");
|
||||||
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
||||||
assertThat(result.isValid()).isFalse();
|
assertThat(result.isValid()).isFalse();
|
||||||
|
|
@ -67,7 +67,7 @@ public class ScenarioBuilderTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoAccept() {
|
public void testNoAccept() {
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.acceptWith((String) null);
|
builder.acceptWith((String) null);
|
||||||
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
||||||
assertThat(result.isValid()).isTrue();
|
assertThat(result.isValid()).isTrue();
|
||||||
|
|
@ -75,7 +75,7 @@ public class ScenarioBuilderTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAccept() {
|
public void testInvalidAccept() {
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.acceptWith("/////");
|
builder.acceptWith("/////");
|
||||||
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
final Result<Scenario, String> result = builder.build(Simple.createContentRepository());
|
||||||
assertThat(result.isValid()).isFalse();
|
assertThat(result.isValid()).isFalse();
|
||||||
|
|
@ -93,7 +93,7 @@ public class ScenarioBuilderTest {
|
||||||
ns2.put("n2", "http://n2.org");
|
ns2.put("n2", "http://n2.org");
|
||||||
final XPathExecutable accept = repository.createXPath("//n2:*", ns2);
|
final XPathExecutable accept = repository.createXPath("//n2:*", ns2);
|
||||||
|
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.getNamespaces().clear();
|
builder.getNamespaces().clear();
|
||||||
|
|
||||||
builder.match(match).acceptWith(accept).declareNamespace("n3", "http://n3.org");
|
builder.match(match).acceptWith(accept).declareNamespace("n3", "http://n3.org");
|
||||||
|
|
@ -111,7 +111,7 @@ public class ScenarioBuilderTest {
|
||||||
final ContentRepository repository = Simple.createContentRepository();
|
final ContentRepository repository = Simple.createContentRepository();
|
||||||
final XPathExecutable match = repository.createXPath("//*", null);
|
final XPathExecutable match = repository.createXPath("//*", null);
|
||||||
final XPathExecutable accept = repository.createXPath("//*", null);
|
final XPathExecutable accept = repository.createXPath("//*", null);
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.getNamespaces().clear();
|
builder.getNamespaces().clear();
|
||||||
|
|
||||||
builder.match(match);
|
builder.match(match);
|
||||||
|
|
@ -128,7 +128,7 @@ public class ScenarioBuilderTest {
|
||||||
public void testBasicAttributes() {
|
public void testBasicAttributes() {
|
||||||
final ContentRepository repository = Simple.createContentRepository();
|
final ContentRepository repository = Simple.createContentRepository();
|
||||||
final String random = RandomStringUtils.random(5);
|
final String random = RandomStringUtils.random(5);
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.name(random).description(random);
|
builder.name(random).description(random);
|
||||||
final Result<Scenario, String> result = builder.build(repository);
|
final Result<Scenario, String> result = builder.build(repository);
|
||||||
assertThat(result.isValid()).isTrue();
|
assertThat(result.isValid()).isTrue();
|
||||||
|
|
@ -141,7 +141,7 @@ public class ScenarioBuilderTest {
|
||||||
@Test
|
@Test
|
||||||
public void testNoBasicAttributes() {
|
public void testNoBasicAttributes() {
|
||||||
final ContentRepository repository = Simple.createContentRepository();
|
final ContentRepository repository = Simple.createContentRepository();
|
||||||
final ScenarioBuilder builder = createScenarioConfiguration();
|
final ScenarioBuilder builder = createScenario();
|
||||||
builder.name(null);
|
builder.name(null);
|
||||||
final Result<Scenario, String> result = builder.build(repository);
|
final Result<Scenario, String> result = builder.build(repository);
|
||||||
assertThat(result.isValid()).isTrue();
|
assertThat(result.isValid()).isTrue();
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
||||||
package de.kosit.validationtool.config;
|
package de.kosit.validationtool.config;
|
||||||
|
|
||||||
import static de.kosit.validationtool.config.ConfigurationBuilder.fallback;
|
import static de.kosit.validationtool.config.ConfigurationBuilder.fallback;
|
||||||
import static de.kosit.validationtool.config.ConfigurationBuilder.report;
|
import static de.kosit.validationtool.config.TestScenarioFactory.createScenario;
|
||||||
import static de.kosit.validationtool.config.ConfigurationBuilder.scenario;
|
|
||||||
import static de.kosit.validationtool.config.ConfigurationBuilder.schema;
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import de.kosit.validationtool.api.Configuration;
|
import de.kosit.validationtool.api.Configuration;
|
||||||
|
|
@ -33,18 +29,12 @@ public class SimpleConfigTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConfigurationBuilder createSimpleConfiguration() {
|
static ConfigurationBuilder createSimpleConfiguration() {
|
||||||
return Configuration.create().name("Simple-API").with(createScenarioConfiguration()
|
return Configuration.create().name("Simple-API").with(createScenario()
|
||||||
// .description("awesome api")
|
// .description("awesome api")
|
||||||
).with(fallback().name("default").source("report.xsl"))
|
).with(fallback().name("default").source("report.xsl"))
|
||||||
|
|
||||||
.resolvingMode(ResolvingMode.STRICT_RELATIVE).useRepository(Simple.REPOSITORY_URI);
|
.resolvingMode(ResolvingMode.STRICT_RELATIVE).useRepository(Simple.REPOSITORY_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ScenarioBuilder createScenarioConfiguration() {
|
|
||||||
return scenario("simple").validate(schema("Sample Schema").schemaLocation(URI.create("simple.xsd")))
|
|
||||||
.with(report("Report für eRechnung").source("report.xsl")).acceptWith("count(//test:rejected) = 0")
|
|
||||||
.declareNamespace("cri", "http://www.xoev.de/de/validator/framework/1/createreportinput")
|
|
||||||
.declareNamespace("rpt", "http://validator.kosit.de/test-report")
|
|
||||||
.declareNamespace("test", "http://validator.kosit.de/test-sample").match("/test:simple");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package de.kosit.validationtool.config;
|
||||||
|
|
||||||
|
import static de.kosit.validationtool.config.ConfigurationBuilder.report;
|
||||||
|
import static de.kosit.validationtool.config.ConfigurationBuilder.scenario;
|
||||||
|
import static de.kosit.validationtool.config.ConfigurationBuilder.schema;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Andreas Penski
|
||||||
|
*/
|
||||||
|
public class TestScenarioFactory {
|
||||||
|
|
||||||
|
public static ScenarioBuilder createScenario() {
|
||||||
|
return scenario("simple").validate(schema("Sample Schema").schemaLocation(URI.create("simple.xsd")))
|
||||||
|
.with(report("Report für eRechnung").source("report.xsl")).acceptWith("count(//test:rejected) = 0")
|
||||||
|
.declareNamespace("cri", "http://www.xoev.de/de/validator/framework/1/createreportinput")
|
||||||
|
.declareNamespace("rpt", "http://validator.kosit.de/test-report")
|
||||||
|
.declareNamespace("test", "http://validator.kosit.de/test-sample").match("/test:simple");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -82,6 +82,7 @@ public class Helper {
|
||||||
return new ContentRepository(strategy, Simple.REPOSITORY_URI);
|
return new ContentRepository(strategy, Simple.REPOSITORY_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static URI getSchemaLocation() {
|
public static URI getSchemaLocation() {
|
||||||
return ROOT.resolve("repository/simple.xsd");
|
return ROOT.resolve("repository/simple.xsd");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
package de.kosit.validationtool.impl.tasks;
|
||||||
|
|
||||||
|
import static de.kosit.validationtool.config.TestScenarioFactory.createScenario;
|
||||||
|
import static de.kosit.validationtool.impl.Helper.serialize;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import javax.xml.transform.Source;
|
||||||
|
|
||||||
|
import org.hamcrest.Matchers;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
|
import de.kosit.validationtool.api.InputFactory;
|
||||||
|
import de.kosit.validationtool.impl.ContentRepository;
|
||||||
|
import de.kosit.validationtool.impl.ConversionService;
|
||||||
|
import de.kosit.validationtool.impl.Helper.Simple;
|
||||||
|
import de.kosit.validationtool.impl.Scenario;
|
||||||
|
import de.kosit.validationtool.impl.model.Result;
|
||||||
|
import de.kosit.validationtool.impl.tasks.CheckAction.Bag;
|
||||||
|
|
||||||
|
import net.sf.saxon.s9api.DocumentBuilder;
|
||||||
|
import net.sf.saxon.s9api.Processor;
|
||||||
|
import net.sf.saxon.s9api.SaxonApiException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for {@link CreateReportAction}.
|
||||||
|
*
|
||||||
|
* @author Andreas Penski
|
||||||
|
*/
|
||||||
|
public class CreateReportActionTest {
|
||||||
|
|
||||||
|
private CreateReportAction action;
|
||||||
|
|
||||||
|
private ContentRepository repository;
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public ExpectedException expectedException = ExpectedException.none();
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
this.repository = Simple.createContentRepository();
|
||||||
|
this.action = new CreateReportAction(this.repository.getProcessor(), new ConversionService(), this.repository.getResolver());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSimpleCreate() {
|
||||||
|
final Bag bag = TestBagBuilder.createBag(true, true);
|
||||||
|
final Scenario scenario = createScenario().build(this.repository).getObject();
|
||||||
|
bag.setScenarioSelectionResult(new Result<>(scenario));
|
||||||
|
bag.setReport(null);
|
||||||
|
this.action.check(bag);
|
||||||
|
assertThat(bag.getReport()).isNotNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNoValidParseResult() {
|
||||||
|
// e.g. no valid xml file specified
|
||||||
|
final Bag bag = TestBagBuilder.createBag(InputFactory.read("someBytes".getBytes(), "invalid"), true);
|
||||||
|
final Scenario scenario = createScenario().build(this.repository).getObject();
|
||||||
|
bag.setScenarioSelectionResult(new Result<>(scenario));
|
||||||
|
assertThat(bag.getReport()).isNull();
|
||||||
|
this.action.check(bag);
|
||||||
|
assertThat(bag.getReport()).isNotNull();
|
||||||
|
final String reportString = serialize(bag.getReport());
|
||||||
|
assertThat(reportString).contains("SAXParseException");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testExecutionException() throws SaxonApiException {
|
||||||
|
this.expectedException.expect(IllegalStateException.class);
|
||||||
|
this.expectedException.expectMessage(Matchers.containsString("Can not create final report"));
|
||||||
|
final Processor p = mock(Processor.class);
|
||||||
|
final DocumentBuilder documentBuilder = mock(DocumentBuilder.class);
|
||||||
|
this.action = new CreateReportAction(p, new ConversionService(), null);
|
||||||
|
|
||||||
|
when(p.newDocumentBuilder()).thenReturn(documentBuilder);
|
||||||
|
when(documentBuilder.build(any(Source.class))).thenThrow(new SaxonApiException("mocked"));
|
||||||
|
this.action.check(TestBagBuilder.createBag(InputFactory.read(Simple.SIMPLE_VALID), true));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.kosit.validationtool.impl;
|
package de.kosit.validationtool.impl.tasks;
|
||||||
|
|
||||||
import static de.kosit.validationtool.api.InputFactory.read;
|
import static de.kosit.validationtool.api.InputFactory.read;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
@ -27,9 +27,9 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
|
import de.kosit.validationtool.impl.Helper;
|
||||||
import de.kosit.validationtool.impl.Helper.Simple;
|
import de.kosit.validationtool.impl.Helper.Simple;
|
||||||
import de.kosit.validationtool.impl.model.Result;
|
import de.kosit.validationtool.impl.model.Result;
|
||||||
import de.kosit.validationtool.impl.tasks.DocumentParseAction;
|
|
||||||
import de.kosit.validationtool.model.reportInput.XMLSyntaxError;
|
import de.kosit.validationtool.model.reportInput.XMLSyntaxError;
|
||||||
|
|
||||||
import net.sf.saxon.s9api.XdmNode;
|
import net.sf.saxon.s9api.XdmNode;
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package de.kosit.validationtool.impl.xml;
|
||||||
|
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.Mockito.doThrow;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.times;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
|
import javax.xml.XMLConstants;
|
||||||
|
import javax.xml.validation.SchemaFactory;
|
||||||
|
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.ExpectedException;
|
||||||
|
import org.xml.sax.SAXNotRecognizedException;
|
||||||
|
import org.xml.sax.SAXNotSupportedException;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Tests the internal functions used to create a secure resolver
|
||||||
|
*
|
||||||
|
* @author Andreas Penski
|
||||||
|
*/
|
||||||
|
public class BaseResolverTest {
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
private class TestResolvingStrategy extends StrictRelativeResolvingStrategy {
|
||||||
|
|
||||||
|
void setInternalProperty(final SchemaFactory factory, final boolean lenient) {
|
||||||
|
allowExternalSchema(factory, lenient, "quatsch");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public ExpectedException expectedException = ExpectedException.none();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIgnoreUnsupportedProperty() throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||||
|
final SchemaFactory sf = mock(SchemaFactory.class);
|
||||||
|
final TestResolvingStrategy s = new TestResolvingStrategy();
|
||||||
|
doThrow(new SAXNotRecognizedException("not supported")).when(sf).setProperty(any(), any());
|
||||||
|
s.setInternalProperty(sf, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFailOnUnsupportedProperty() throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||||
|
this.expectedException.expect(IllegalStateException.class);
|
||||||
|
final SchemaFactory sf = mock(SchemaFactory.class);
|
||||||
|
final TestResolvingStrategy s = new TestResolvingStrategy();
|
||||||
|
doThrow(new SAXNotRecognizedException("not supported")).when(sf).setProperty(any(), any());
|
||||||
|
s.setInternalProperty(sf, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSimpleSuccess() throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||||
|
final SchemaFactory sf = mock(SchemaFactory.class);
|
||||||
|
final TestResolvingStrategy s = new TestResolvingStrategy();
|
||||||
|
s.setInternalProperty(sf, true);
|
||||||
|
s.setInternalProperty(sf, false);
|
||||||
|
verify(sf, times(2)).setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "quatsch");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue