14-FixDeclarationRedundancyIssues

This commit is contained in:
Adrian-Devries 2025-04-24 12:54:04 +02:00
parent 7a81f0c042
commit 46fdd703c3
43 changed files with 90 additions and 50 deletions

View file

@ -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);

View file

@ -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();
}

View file

@ -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());
}

View file

@ -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;

View file

@ -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()));
}

View file

@ -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));
}

View file

@ -87,6 +87,7 @@ public class Helper {
return new ContentRepository(Helper.getTestProcessor(), strategy, Simple.REPOSITORY_URI);
}
@SuppressWarnings("SameReturnValue")
public static URI getSchemaLocation() {
return SCHEMA;
}

View file

@ -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()));
}

View file

@ -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<>());
}

View file

@ -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()));
}

View file

@ -43,7 +43,7 @@ public class StreamHelperTest {
}
@Override
public int available() throws IOException {
public int available() {
return 0;
}
}

View file

@ -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.*;
/**

View file

@ -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.*;
/**

View file

@ -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();
}

View file

@ -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()));

View file

@ -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()));