mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
14-FixDeclarationRedundancyIssues
This commit is contained in:
parent
7a81f0c042
commit
46fdd703c3
43 changed files with 90 additions and 50 deletions
|
|
@ -191,6 +191,7 @@ public class InputFactory {
|
|||
* @param name the digest algorithm
|
||||
* @return an {@link Input}
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static Input read(final Source source, final String name) {
|
||||
checkNotEmpty(name);
|
||||
return read(source, name, PSEUDO_NAME_ALGORITHM, name.getBytes());
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ public interface XmlError {
|
|||
* @return der Schweregrad
|
||||
* @see Severity
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
Severity getSeverity();
|
||||
|
||||
/**
|
||||
|
|
@ -53,7 +54,9 @@ public interface XmlError {
|
|||
Integer getColumnNumber();
|
||||
|
||||
enum Severity {
|
||||
SEVERITY_WARNING, SEVERITY_ERROR, SEVERITY_FATAL_ERROR
|
||||
@SuppressWarnings("unused")
|
||||
SEVERITY_WARNING, SEVERITY_ERROR, @SuppressWarnings("unused")
|
||||
SEVERITY_FATAL_ERROR
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class CheckAssertionAction implements CheckAction {
|
|||
|
||||
}
|
||||
|
||||
private XPathSelector createSelector(AssertionType assertion) throws SaxonApiException {
|
||||
private XPathSelector createSelector(AssertionType assertion) {
|
||||
try {
|
||||
final XPathCompiler compiler = getProcessor().newXPathCompiler();
|
||||
assertions.getNamespace().forEach(ns -> compiler.declareNamespace(ns.getPrefix(), ns.getValue()));
|
||||
|
|
|
|||
|
|
@ -94,16 +94,22 @@ public class CommandLineApplication {
|
|||
return resultStatus;
|
||||
}
|
||||
|
||||
private static int logExecutionException(final Exception ex, final CommandLine cli, final ParseResult parseResult) {
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
private static int logExecutionException(final Exception ex, @SuppressWarnings("unused") final CommandLine cli,
|
||||
@SuppressWarnings("unused") final ParseResult parseResult) {
|
||||
final String message = isNotEmpty(ex.getMessage()) ? ex.getMessage() : "Es ist eine Fehler aufgetreten";
|
||||
Printer.writeErr(ex, message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
enum Level {
|
||||
|
||||
INFO, WARN, DEBUG, TRACE, ERROR, OFF
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
INFO, @SuppressWarnings("unused")
|
||||
WARN, @SuppressWarnings("unused")
|
||||
DEBUG, @SuppressWarnings("unused")
|
||||
TRACE, @SuppressWarnings("unused")
|
||||
ERROR, @SuppressWarnings("unused")
|
||||
OFF
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ import java.util.concurrent.Callable;
|
|||
*
|
||||
* @author Andreas Penski
|
||||
*/
|
||||
@Command(description = "Structural and semantic validation of xml files", name = "KoSIT Validator", mixinStandardHelpOptions = false,
|
||||
separator = " ")
|
||||
@Command(description = "Structural and semantic validation of xml files", name = "KoSIT Validator", separator = " ")
|
||||
@Getter
|
||||
public class CommandLineOptions implements Callable<ReturnValue> {
|
||||
|
||||
|
|
@ -166,7 +165,7 @@ public class CommandLineOptions implements Callable<ReturnValue> {
|
|||
private List<ScenarioDefinition> scenarios;
|
||||
|
||||
@Override
|
||||
public ReturnValue call() throws Exception {
|
||||
public ReturnValue call() {
|
||||
configureLogging(this);
|
||||
return Validator.mainProgram(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class TypeConverter {
|
|||
public static class RepositoryConverter implements ITypeConverter<RepositoryDefinition> {
|
||||
|
||||
@Override
|
||||
public RepositoryDefinition convert(final String value) throws Exception {
|
||||
public RepositoryDefinition convert(final String value) {
|
||||
return TypeConverter.convert(RepositoryDefinition.class, value);
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ class TypeConverter {
|
|||
public static class ScenarioConverter implements ITypeConverter<ScenarioDefinition> {
|
||||
|
||||
@Override
|
||||
public ScenarioDefinition convert(final String value) throws Exception {
|
||||
public ScenarioDefinition convert(final String value) {
|
||||
return TypeConverter.convert(ScenarioDefinition.class, value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@ public class Validator {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private static void assertFileExistance(final Path f, final String type) {
|
||||
if (!Files.isRegularFile(f)) {
|
||||
throw new IllegalArgumentException(
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class Format {
|
|||
*
|
||||
* @return this {@link Format}
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public Format color(final Code textColor) {
|
||||
this.textColor = textColor;
|
||||
return this;
|
||||
|
|
@ -80,6 +81,7 @@ public class Format {
|
|||
*
|
||||
* @return this {@link Format}
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public Format background(final Code color) {
|
||||
this.background = color;
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public class Grid {
|
|||
*
|
||||
* @param name the name of the column
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public ColumnDefinition(final String name) {
|
||||
this(name, -1, -1, 1);
|
||||
}
|
||||
|
|
@ -147,6 +148,7 @@ public class Grid {
|
|||
this.text.add(txt);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public Cell(final Object object, final Code... codes) {
|
||||
this(new Text(object, codes));
|
||||
}
|
||||
|
|
@ -192,6 +194,7 @@ public class Grid {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public Cell add(final Object object, final Code... codes) {
|
||||
this.text.add(new Text(object, codes));
|
||||
return this;
|
||||
|
|
@ -237,6 +240,7 @@ public class Grid {
|
|||
* @param def definitions
|
||||
* @return this grid
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public Grid addColumn(final ColumnDefinition def) {
|
||||
this.definitions.add(def);
|
||||
return this;
|
||||
|
|
@ -263,6 +267,7 @@ public class Grid {
|
|||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public Grid addCell(final Text... text) {
|
||||
return addCell(new Cell(Arrays.asList(text)));
|
||||
}
|
||||
|
|
@ -274,6 +279,7 @@ public class Grid {
|
|||
return addCell(new Cell(t));
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public Grid addCell(final Object cell) {
|
||||
return addCell(cell, DEFAULT_FORMAT.getTextColor());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,10 @@ public enum Justify {
|
|||
return StringUtils.center(string, length);
|
||||
}
|
||||
},
|
||||
@SuppressWarnings("unused")
|
||||
RIGHT {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
public String apply(final String string, final int length) {
|
||||
return StringUtils.leftPad(string, length);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public class Line {
|
|||
return add(new Text(text, codes));
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public Line add(final Object text, final Format format) {
|
||||
return add(new Text(text, format));
|
||||
}
|
||||
|
|
@ -107,6 +108,7 @@ public class Line {
|
|||
return this.texts.stream().mapToInt(Text::getLength).sum();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static String render(final String text, final Code... codes) {
|
||||
return new Line().add(text, codes).render();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,5 +32,6 @@ interface Builder<T> {
|
|||
* @param repository the {@link ContentRepository}
|
||||
* @return the result of building the object
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
Result<T, String> build(ContentRepository repository);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ public class ConfigurationBuilder {
|
|||
*
|
||||
* @return a fallback configuration
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static FallbackBuilder defaultFallback() {
|
||||
throw new NotImplementedException("Not yet defined");
|
||||
}
|
||||
|
|
@ -193,6 +194,7 @@ public class ConfigurationBuilder {
|
|||
*
|
||||
* @return a configuration builder for schema
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static SchemaBuilder schema() {
|
||||
return new SchemaBuilder();
|
||||
}
|
||||
|
|
@ -204,6 +206,7 @@ public class ConfigurationBuilder {
|
|||
* @param schema the actual precompiled schema to use
|
||||
* @return a configuration builder for schema
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static SchemaBuilder schema(final String name, final Schema schema) {
|
||||
return new SchemaBuilder().name(name).schema(schema);
|
||||
}
|
||||
|
|
@ -243,6 +246,7 @@ public class ConfigurationBuilder {
|
|||
*
|
||||
* @return the scenario configuration builder
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static ScenarioBuilder scenario() {
|
||||
return scenario(null);
|
||||
}
|
||||
|
|
@ -350,6 +354,7 @@ public class ConfigurationBuilder {
|
|||
* @param strategy the strategy
|
||||
* @return this
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public ConfigurationBuilder resolvingStrategy(final ResolvingConfigurationStrategy strategy) {
|
||||
this.resolvingConfigurationStrategy = strategy;
|
||||
return this;
|
||||
|
|
@ -372,6 +377,7 @@ public class ConfigurationBuilder {
|
|||
* @param repository the repository location
|
||||
* @return this
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public ConfigurationBuilder useRepository(final Path repository) {
|
||||
return useRepository(repository.toUri());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ public class ConfigurationLoader {
|
|||
* @param value the parameter value object
|
||||
* @return this
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public ConfigurationLoader addParameter(final String name, final Object value) {
|
||||
this.parameters.put(name, value);
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public class FallbackBuilder implements Builder<Scenario> {
|
|||
* @param source the source
|
||||
* @return this
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public FallbackBuilder source(final URI source) {
|
||||
this.internal.source(source);
|
||||
return this;
|
||||
|
|
@ -96,6 +97,7 @@ public class FallbackBuilder implements Builder<Scenario> {
|
|||
* @param source the source
|
||||
* @return this
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public FallbackBuilder source(final Path source) {
|
||||
this.internal.source(source);
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ public class ReportBuilder implements Builder<Pair<CreateReportType, Transformat
|
|||
* @param source the source
|
||||
* @return this
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public ReportBuilder source(final Path source) {
|
||||
return source(source.toUri());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ public class SchematronBuilder implements Builder<Pair<ValidateWithSchematron, T
|
|||
* @param source the source
|
||||
* @return this
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public SchematronBuilder source(final Path source) {
|
||||
return source(source.toUri());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import lombok.Getter;
|
|||
import net.sf.saxon.s9api.MessageListener;
|
||||
import net.sf.saxon.s9api.XdmNode;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import javax.xml.transform.ErrorListener;
|
||||
|
|
@ -112,17 +111,17 @@ public class CollectingErrorEventHandler implements ValidationEventHandler, Erro
|
|||
}
|
||||
|
||||
@Override
|
||||
public void warning(final SAXParseException exception) throws SAXException {
|
||||
public void warning(final SAXParseException exception) {
|
||||
this.errors.add(createError(XMLSyntaxErrorSeverity.SEVERITY_WARNING, exception));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(final SAXParseException exception) throws SAXException {
|
||||
public void error(final SAXParseException exception) {
|
||||
this.errors.add(createError(XMLSyntaxErrorSeverity.SEVERITY_ERROR, exception));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatalError(final SAXParseException exception) throws SAXException {
|
||||
public void fatalError(final SAXParseException exception) {
|
||||
this.errors.add(createError(XMLSyntaxErrorSeverity.SEVERITY_FATAL_ERROR, exception));
|
||||
}
|
||||
|
||||
|
|
@ -139,17 +138,17 @@ public class CollectingErrorEventHandler implements ValidationEventHandler, Erro
|
|||
}
|
||||
|
||||
@Override
|
||||
public void warning(final TransformerException exception) throws TransformerException {
|
||||
public void warning(final TransformerException exception) {
|
||||
this.errors.add(createError(XMLSyntaxErrorSeverity.SEVERITY_WARNING, exception));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(final TransformerException exception) throws TransformerException {
|
||||
public void error(final TransformerException exception) {
|
||||
this.errors.add(createError(XMLSyntaxErrorSeverity.SEVERITY_ERROR, exception));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatalError(final TransformerException exception) throws TransformerException {
|
||||
public void fatalError(final TransformerException exception) {
|
||||
this.errors.add(createError(XMLSyntaxErrorSeverity.SEVERITY_FATAL_ERROR, exception));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ public class DefaultResult implements Result {
|
|||
return filterSchematronResult(FailedAssert.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private <T> List<T> filterSchematronResult(final Class<T> type) {
|
||||
return getSchematronResult() != null
|
||||
? getSchematronResult().stream().flatMap(e -> e.getActivePatternAndFiredRuleAndFailedAssert().stream())
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public class HtmlExtractor {
|
|||
return this.executable.load();
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private XPathExecutable createXPath(final String expression, final Map<String, String> namespaces) {
|
||||
try {
|
||||
final XPathCompiler compiler = this.processor.newXPathCompiler();
|
||||
|
|
|
|||
|
|
@ -38,10 +38,12 @@ public enum ResolvingMode {
|
|||
|
||||
},
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
STRICT_LOCAL(new StrictLocalResolvingStrategy()),
|
||||
|
||||
ALLOW_REMOTE(new RemoteResolvingStrategy()),
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
CUSTOM(null);
|
||||
|
||||
@Getter
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ interface LazyReadInput {
|
|||
*
|
||||
* @return true when computed
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
boolean isHashcodeComputed();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public final class SourceInput extends AbstractInput {
|
|||
|
||||
private final String digestAlgorithm;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public SourceInput(final StreamSource source, final String name, final String digestAlgorithm) {
|
||||
this(source, name, digestAlgorithm, null);
|
||||
}
|
||||
|
|
@ -99,7 +100,7 @@ public final class SourceInput extends AbstractInput {
|
|||
return isStreamSource();
|
||||
}
|
||||
|
||||
private boolean isConsumed() throws IOException {
|
||||
private boolean isConsumed() {
|
||||
if (isStreamSource()) {
|
||||
|
||||
final StreamSource ss = (StreamSource) this.source;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public class Result<T, E> {
|
|||
|
||||
private T object;
|
||||
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
private Collection<E> errors = new ArrayList<>();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public class CreateReportAction implements CheckAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean getFeature(final String name) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
public boolean getFeature(final String name) {
|
||||
if (SAX_FEATURES_NAMESPACES.equals(name)) {
|
||||
return true;
|
||||
} else if (SAX_FEATURES_NAMESPACE_PREFIXES.equals(name)) {
|
||||
|
|
@ -149,7 +149,7 @@ public class CreateReportAction implements CheckAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException {
|
||||
// this inverts the logic from JaxbSource pseude parser
|
||||
if (name.equals(SAX_FEATURES_NAMESPACES) && !value) {
|
||||
throw new SAXNotRecognizedException(name);
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ public abstract class BaseResolvingStrategy implements ResolvingConfigurationStr
|
|||
allowExternalSchema(schemaFactory, false, scheme);
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
protected void allowExternalSchema(final Validator validator, final boolean lenient, final String... schemes) {
|
||||
final String schemeString = String.join(",", schemes);
|
||||
setProperty(() -> validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, schemeString), lenient, format(
|
||||
|
|
@ -93,6 +94,7 @@ public abstract class BaseResolvingStrategy implements ResolvingConfigurationStr
|
|||
disableExternalEntities(schemaFactory, false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
protected void disableExternalEntities(final Validator validator, final boolean lenient) {
|
||||
log.debug("Try to disable extern DTD access");
|
||||
setProperty(() -> validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""), lenient,
|
||||
|
|
@ -100,6 +102,7 @@ public abstract class BaseResolvingStrategy implements ResolvingConfigurationStr
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
protected void disableExternalEntities(final SchemaFactory schemaFactory, final boolean lenient) {
|
||||
log.debug("Try to disable extern DTD access");
|
||||
setProperty(() -> schemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""), lenient,
|
||||
|
|
|
|||
|
|
@ -26,11 +26,9 @@ import net.sf.saxon.lib.OutputURIResolver;
|
|||
import net.sf.saxon.lib.ResourceCollection;
|
||||
import net.sf.saxon.lib.UnparsedTextURIResolver;
|
||||
import net.sf.saxon.s9api.Processor;
|
||||
import net.sf.saxon.trans.XPathException;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import java.io.Reader;
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
|
|
@ -51,22 +49,22 @@ public class ProcessorProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result resolve(final String href, final String base) throws TransformerException {
|
||||
public Result resolve(final String href, final String base) {
|
||||
throw new IllegalStateException(MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(final Result result) throws TransformerException {
|
||||
public void close(final Result result) {
|
||||
throw new IllegalStateException(MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reader resolve(final URI absoluteURI, final String encoding, final Configuration config) throws XPathException {
|
||||
public Reader resolve(final URI absoluteURI, final String encoding, final Configuration config) {
|
||||
throw new IllegalStateException(MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceCollection findCollection(final XPathContext context, final String collectionURI) throws XPathException {
|
||||
public ResourceCollection findCollection(final XPathContext context, final String collectionURI) {
|
||||
throw new IllegalStateException(MESSAGE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
|
|
@ -102,13 +101,13 @@ public class InputFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInputFile() throws URISyntaxException {
|
||||
public void testInputFile() {
|
||||
final Input input = InputFactory.read(new File(Simple.SIMPLE_VALID));
|
||||
assertThat(input).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInputPath() throws URISyntaxException {
|
||||
public void testInputPath() {
|
||||
final Input input = InputFactory.read(Paths.get(Simple.SIMPLE_VALID));
|
||||
assertThat(input).isNotNull();
|
||||
}
|
||||
|
|
@ -124,7 +123,7 @@ public class InputFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyInputName() throws IOException {
|
||||
public void testEmptyInputName() {
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
final Input input = InputFactory.read(SOME_VALUE.getBytes(), "");
|
||||
drain(input);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import de.kosit.validationtool.model.reportInput.CreateReportInput;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
|
|
@ -45,7 +44,7 @@ public class CheckAssertionActionTest {
|
|||
private static final URL SAMPLE_ASSERTIONS = CheckAssertionActionTest.class.getResource("/examples/assertions/tests-xrechnung.xml");
|
||||
|
||||
@Before
|
||||
public void setup() throws IOException {
|
||||
public void setup() {
|
||||
CommandLine.activate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public class CommandLine {
|
|||
return new InputStream() {
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
public int read() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
@ -124,6 +124,7 @@ public class CommandLine {
|
|||
return readLines(out.getOut().toByteArray());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static List<String> getErrorLines() {
|
||||
return readLines(error.getOut().toByteArray());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.text.RandomStringGenerator;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import de.kosit.validationtool.impl.ContentRepository;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class ContentRepositoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCreateSchemaNotExisting() throws Exception {
|
||||
public void testCreateSchemaNotExisting() {
|
||||
assertThrows(IllegalStateException.class, () -> this.repository.createSchema(Simple.NOT_EXISTING.toURL()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.junit.Before;
|
||||
|
|
@ -94,12 +93,12 @@ public class ConversionServiceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnmarshalUnknownType() throws URISyntaxException {
|
||||
public void testUnmarshalUnknownType() {
|
||||
assertThrows(ConversionService.ConversionException.class, () -> this.service.readXml(Simple.SCENARIOS, ConversionService.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnmarshalWithoutType() throws URISyntaxException {
|
||||
public void testUnmarshalWithoutType() {
|
||||
assertThrows(ConversionService.ConversionException.class, () -> this.service.readXml(Simple.SCENARIOS, null));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ public class Helper {
|
|||
return new ContentRepository(Helper.getTestProcessor(), strategy, Simple.REPOSITORY_URI);
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
public static URI getSchemaLocation() {
|
||||
return SCHEMA;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,12 +57,12 @@ public class RelativeUriResolverTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNotExisting() throws TransformerException {
|
||||
public void testNotExisting() {
|
||||
assertThrows(TransformerException.class, () -> this.resolver.resolve("ubl-0001", BASE.toASCIIString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOutOfPath() throws TransformerException {
|
||||
public void testOutOfPath() {
|
||||
assertThrows(TransformerException.class, () -> this.resolver.resolve("../results/report.xml", BASE.toASCIIString()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,10 +121,12 @@ public class ScenarioRepositoryTest {
|
|||
assertThat(fallback).isNotSameAs(second.getFallbackScenario());
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private XdmNode load(final URI uri) throws IOException {
|
||||
return Helper.parseDocument(this.configInstance.getContentRepository().getProcessor(), read(uri.toURL())).getObject();
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private XPathExecutable createXpath(final String expression) {
|
||||
return this.configInstance.getContentRepository().createXPath(expression, new HashMap<>());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package de.kosit.validationtool.impl;
|
||||
|
||||
import de.kosit.validationtool.impl.Helper.Simple;
|
||||
import de.kosit.validationtool.model.scenarios.Scenarios;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -62,13 +61,13 @@ public class VersioningTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNewFeature() throws URISyntaxException {
|
||||
public void testNewFeature() {
|
||||
assertThrows(ConversionService.ConversionException.class,
|
||||
() -> this.service.readXml(NEW_FEATURE.toURI(), Scenarios.class, SchemaProvider.getScenarioSchema()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNewVersion() throws URISyntaxException {
|
||||
public void testNewVersion() {
|
||||
assertThrows(ConversionService.ConversionException.class,
|
||||
() -> this.service.readXml(NEW_VERSION.toURI(), Scenarios.class, SchemaProvider.getScenarioSchema()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class StreamHelperTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
public int available() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import java.net.MalformedURLException;
|
|||
|
||||
import static de.kosit.validationtool.impl.tasks.TestBagBuilder.createBag;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import javax.xml.XMLConstants;
|
|||
import javax.xml.validation.SchemaFactory;
|
||||
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ import javax.xml.validation.SchemaFactory;
|
|||
/**
|
||||
* @author Andreas Penski
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class SchemaProviderTest {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final SchemaFactory schemaFactory = ResolvingMode.STRICT_RELATIVE.getStrategy().createSchemaFactory();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static org.junit.Assert.assertThrows;
|
|||
public class StrictLocalResolvingTest {
|
||||
|
||||
@Test
|
||||
public void testRemoteSchemaResolving() throws Exception {
|
||||
public void testRemoteSchemaResolving() {
|
||||
final ResolvingConfigurationStrategy s = new StrictLocalResolvingStrategy();
|
||||
final SchemaFactory schemaFactory = s.createSchemaFactory();
|
||||
Throwable e = assertThrows(SAXParseException.class, () -> schemaFactory.newSchema(Resolving.SCHEMA_WITH_REMOTE_REFERENCE.toURL()));
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static org.junit.Assert.assertThrows;
|
|||
public class StrictRelativeResolvingTest {
|
||||
|
||||
@Test
|
||||
public void testRemoteSchemaResolving() throws Exception {
|
||||
public void testRemoteSchemaResolving() {
|
||||
final ResolvingConfigurationStrategy s = new StrictLocalResolvingStrategy();
|
||||
final SchemaFactory schemaFactory = s.createSchemaFactory();
|
||||
Throwable e = assertThrows(SAXParseException.class, () -> schemaFactory.newSchema(Resolving.SCHEMA_WITH_REMOTE_REFERENCE.toURL()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue