13-FixCodeStyleIssues

This commit is contained in:
Adrian-Devries 2025-04-24 12:54:02 +02:00
parent 76c331acd1
commit 7a81f0c042
8 changed files with 25 additions and 28 deletions

View file

@ -53,7 +53,7 @@ public interface XmlError {
Integer getColumnNumber(); Integer getColumnNumber();
enum Severity { enum Severity {
SEVERITY_WARNING, SEVERITY_ERROR, SEVERITY_FATAL_ERROR; SEVERITY_WARNING, SEVERITY_ERROR, SEVERITY_FATAL_ERROR
} }
} }

View file

@ -102,7 +102,7 @@ public class CommandLineApplication {
enum Level { enum Level {
INFO, WARN, DEBUG, TRACE, ERROR, OFF; INFO, WARN, DEBUG, TRACE, ERROR, OFF
} }

View file

@ -257,7 +257,7 @@ public class Validator {
if (cmd.getOutputPath() != null) { if (cmd.getOutputPath() != null) {
dir = cmd.getOutputPath(); dir = cmd.getOutputPath();
if ((!Files.exists(dir) && !dir.toFile().mkdirs()) || !Files.isDirectory(dir)) { if ((!Files.exists(dir) && !dir.toFile().mkdirs()) || !Files.isDirectory(dir)) {
throw new IllegalStateException(String.format("Invalid target directory %s specified", dir.toString())); throw new IllegalStateException(String.format("Invalid target directory %s specified", dir));
} }
} else { } else {
dir = Paths.get(""/* cwd */); dir = Paths.get(""/* cwd */);

View file

@ -310,7 +310,7 @@ public class Grid {
if (isEmpty(current) || virtualLine >= getMaxVirtualLine()) { if (isEmpty(current) || virtualLine >= getMaxVirtualLine()) {
break; break;
} }
b.append(current.toString()); b.append(current);
virtualLine++; virtualLine++;
b.append("\n"); b.append("\n");
} }
@ -319,7 +319,7 @@ public class Grid {
} }
private static boolean isEmpty(final StringBuilder current) { private static boolean isEmpty(final StringBuilder current) {
return current.toString().replaceAll("\\|", "").trim().length() == 0; return current.toString().replaceAll("\\|", "").trim().isEmpty();
} }
private int getMaxVirtualLine() { private int getMaxVirtualLine() {

View file

@ -40,7 +40,7 @@ public interface HttpStatus {
int SC_NOT_ACCEPTABLE = 406; int SC_NOT_ACCEPTABLE = 406;
/** {@code 422 Unprocessable Entity} (WebDAV - RFC 2518) */ /** {@code 422 Unprocessable Entity} (WebDAV - RFC 2518) */
public static final int SC_UNPROCESSABLE_ENTITY = 422; int SC_UNPROCESSABLE_ENTITY = 422;
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */ /** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
int SC_INTERNAL_SERVER_ERROR = 500; int SC_INTERNAL_SERVER_ERROR = 500;

View file

@ -189,7 +189,7 @@ public class ConversionService {
return value; return value;
} catch (final JAXBException | XMLStreamException e) { } catch (final JAXBException | XMLStreamException e) {
throw new ConversionException(String.format("Can not unmarshal to type %s from %s", type.getSimpleName(), xml.toString()), e); throw new ConversionException(String.format("Can not unmarshal to type %s from %s", type.getSimpleName(), xml), e);
} }
} }

View file

@ -69,7 +69,7 @@ public class RelativeUriResolver implements URIResolver, UnparsedTextURIResolver
final boolean jarURI = isJarURI(base); final boolean jarURI = isJarURI(base);
final URI tmpBase = jarURI ? URI.create(base.toASCIIString().substring(4)) : base; final URI tmpBase = jarURI ? URI.create(base.toASCIIString().substring(4)) : base;
final URI result = tmpBase.resolve(href); final URI result = tmpBase.resolve(href);
return jarURI ? URI.create("jar:" + result.toString()) : result; return jarURI ? URI.create("jar:" + result) : result;
} }
static boolean isJarURI(final URI uri) { static boolean isJarURI(final URI uri) {

View file

@ -243,27 +243,26 @@ public class CommandlineApplicationTest {
@Test @Test
public void loadMultipleScenarios() { public void loadMultipleScenarios() {
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s", final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS), "-s", "s2=" + Paths.get(Simple.OTHER_SCENARIOS),
"s2=" + Paths.get(Simple.OTHER_SCENARIOS).toString(), "-r", "s1=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r", "-r", "s1=" + Paths.get(Simple.REPOSITORY_URI), "-r", "s2=" + Paths.get(Simple.REPOSITORY_URI),
"s2=" + Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
CommandLineApplication.mainProgram(args);
assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed");
}
@Test
public void loadMultipleScenariosSingleRepository() {
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s",
"s2=" + Paths.get(Simple.OTHER_SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
Paths.get(Simple.SIMPLE_VALID).toString() }; Paths.get(Simple.SIMPLE_VALID).toString() };
CommandLineApplication.mainProgram(args); CommandLineApplication.mainProgram(args);
assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed"); assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed");
} }
@Test
public void loadMultipleScenariosSingleRepository() {
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS), "-s", "s2=" + Paths.get(Simple.OTHER_SCENARIOS),
"-r", Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
CommandLineApplication.mainProgram(args);
assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed");
}
@Test @Test
public void loadMultipleScenariosMissingRepository() { public void loadMultipleScenariosMissingRepository() {
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s", final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS), "-s", "s2=" + Paths.get(Simple.OTHER_SCENARIOS),
"s2=" + Paths.get(Simple.OTHER_SCENARIOS).toString(), "-r", "s1=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r", "-r", "s1=" + Paths.get(Simple.REPOSITORY_URI), "-r", "typo=" + Paths.get(Simple.REPOSITORY_URI),
"typo=" + Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() }; Paths.get(Simple.SIMPLE_VALID).toString() };
CommandLineApplication.mainProgram(args); CommandLineApplication.mainProgram(args);
assertThat(CommandLine.getErrorOutput()).contains("No repository location for scenario definition 's2' specified"); assertThat(CommandLine.getErrorOutput()).contains("No repository location for scenario definition 's2' specified");
} }
@ -279,9 +278,8 @@ public class CommandlineApplicationTest {
@Test @Test
public void checkUnusedRepository() { public void checkUnusedRepository() {
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-r", final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS), "-r", "s1=" + Paths.get(Simple.REPOSITORY_URI),
"s1=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r", "unused=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r", "unused=" + Paths.get(Simple.REPOSITORY_URI), Paths.get(Simple.SIMPLE_VALID).toString() };
Paths.get(Simple.SIMPLE_VALID).toString() };
CommandLineApplication.mainProgram(args); CommandLineApplication.mainProgram(args);
assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed"); assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed");
assertThat(CommandLine.getErrorOutput()).contains("Warning: repository definition \"unused\" is not used"); assertThat(CommandLine.getErrorOutput()).contains("Warning: repository definition \"unused\" is not used");
@ -289,9 +287,8 @@ public class CommandlineApplicationTest {
@Test @Test
public void checkDuplicationScenarioDefinition() { public void checkDuplicationScenarioDefinition() {
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-r", final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS), "-r", "s1=" + Paths.get(Simple.REPOSITORY_URI),
"s1=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r", "unused=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r", "unused=" + Paths.get(Simple.REPOSITORY_URI), Paths.get(Simple.SIMPLE_VALID).toString() };
Paths.get(Simple.SIMPLE_VALID).toString() };
CommandLineApplication.mainProgram(args); CommandLineApplication.mainProgram(args);
assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed"); assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed");
assertThat(CommandLine.getErrorOutput()).contains("Warning: repository definition \"unused\" is not used"); assertThat(CommandLine.getErrorOutput()).contains("Warning: repository definition \"unused\" is not used");