diff --git a/Application_Properties.java b/Application_Properties.java index e69de29..8b13789 100644 --- a/Application_Properties.java +++ b/Application_Properties.java @@ -0,0 +1 @@ + diff --git a/pom.xml b/pom.xml index 84a3cf8..3627808 100644 --- a/pom.xml +++ b/pom.xml @@ -146,7 +146,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.14.0 + 3.14.1 ${java.version} -proc:none diff --git a/src/main/java/de/kreth/property2java/processor/GenerateProperty2Java.java b/src/main/java/de/kreth/property2java/processor/GenerateProperty2Java.java index 52dda7e..9bc318a 100644 --- a/src/main/java/de/kreth/property2java/processor/GenerateProperty2Java.java +++ b/src/main/java/de/kreth/property2java/processor/GenerateProperty2Java.java @@ -6,6 +6,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; + import de.kreth.property2java.Format; import de.kreth.property2java.GeneratorOptions; diff --git a/src/main/java/de/kreth/property2java/processor/Property2JavaGenerator.java b/src/main/java/de/kreth/property2java/processor/Property2JavaGenerator.java index 492a01e..8860c67 100644 --- a/src/main/java/de/kreth/property2java/processor/Property2JavaGenerator.java +++ b/src/main/java/de/kreth/property2java/processor/Property2JavaGenerator.java @@ -16,6 +16,7 @@ import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic.Kind; + import de.kreth.property2java.Format; import de.kreth.property2java.GeneratorException; import de.kreth.property2java.GeneratorOptions; diff --git a/src/test/java/de/kreth/property2java/ConfigurationTest.java b/src/test/java/de/kreth/property2java/ConfigurationTest.java index ece2f85..674bfd3 100644 --- a/src/test/java/de/kreth/property2java/ConfigurationTest.java +++ b/src/test/java/de/kreth/property2java/ConfigurationTest.java @@ -1,6 +1,7 @@ package de.kreth.property2java; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.when; diff --git a/src/test/java/de/kreth/property2java/GeneratorTests.java b/src/test/java/de/kreth/property2java/GeneratorTests.java index 4cb7388..2f7987b 100644 --- a/src/test/java/de/kreth/property2java/GeneratorTests.java +++ b/src/test/java/de/kreth/property2java/GeneratorTests.java @@ -30,6 +30,7 @@ import java.util.Optional; import java.util.StringTokenizer; import java.util.stream.Collectors; + import org.apache.commons.cli.MissingOptionException; import org.hamcrest.Matchers; import org.junit.jupiter.api.BeforeEach; @@ -198,24 +199,24 @@ class GeneratorTests { when(config.outWriter(anyString())).thenReturn(mock(Writer.class)); doThrow(new TemplateException(null)).when(template).process(any(Map.class), any(Writer.class)); - + Generator generator = new Generator(config, template); - GeneratorException ex = assertThrows(GeneratorException.class, () -> generator.start()); + GeneratorException ex = assertThrows(GeneratorException.class, generator::start); assertThat(ex.getCause()).isInstanceOf(TemplateException.class); } @Test void testMainMethod() throws IOException, GeneratorException { Path source = Files.createTempFile(getClass().getSimpleName(), ".properties"); - Generator.main(new String[] {"-t", "target", "-f", source.toString()}); + Generator.main(new String[]{"-t", "target", "-f", source.toString()}); } @Test void testMainMethodMissingOption() throws IOException, GeneratorException { - IllegalStateException e = assertThrows(IllegalStateException.class, () -> Generator.main(new String[] {})); + IllegalStateException e = assertThrows(IllegalStateException.class, () -> Generator.main(new String[]{})); assertThat(e.getCause()).isInstanceOf(MissingOptionException.class); } - + @Test void testGenerateFor() throws IOException, GeneratorException { Class locationClass = getClass(); @@ -223,7 +224,7 @@ class GeneratorTests { String relativeTargetDir = "target"; Generator.generateFor(locationClass, rescources, relativeTargetDir); } - + private void assertLineMatch(List lines, String key, String expected) { Optional found = lines.stream().filter(line -> keyMatches(line, key)).findFirst(); diff --git a/src/test/java/de/kreth/property2java/processor/Property2JavaGeneratorTest.java b/src/test/java/de/kreth/property2java/processor/Property2JavaGeneratorTest.java index d0ea0be..cb10126 100644 --- a/src/test/java/de/kreth/property2java/processor/Property2JavaGeneratorTest.java +++ b/src/test/java/de/kreth/property2java/processor/Property2JavaGeneratorTest.java @@ -42,40 +42,40 @@ public class Property2JavaGeneratorTest { when(processingEnv.getMessager()).thenReturn(messanger); } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) @Test void testGeneratorInitializedCorrectly() { - + GenerateProperty2Java an = mock(GenerateProperty2Java.class); - when(an.resources()).thenReturn(new String[] {}); + when(an.resources()).thenReturn(new String[]{}); TypeElement element = mock(TypeElement.class); when(element.getAnnotation(GenerateProperty2Java.class)).thenReturn(an); - + annotations.add(element); - + when(roundEnv.getElementsAnnotatedWith(ArgumentMatchers.any(Class.class))).thenReturn(annotations); Element annotatedElement = mock(Element.class); GenerateResourceBundleProperty2Javas value = new GenerateResourceBundleProperty2Javas() { - + @Override public Class annotationType() { return null; } - + @Override public GenerateResourceBundleProperty2Java[] value() { return new GenerateResourceBundleProperty2Java[0]; } }; - when(annotatedElement.getAnnotation(GenerateResourceBundleProperty2Javas.class)).thenReturn(value ); + when(annotatedElement.getAnnotation(GenerateResourceBundleProperty2Javas.class)).thenReturn(value); Set elements = new HashSet<>(List.of(annotatedElement)); - + when(roundEnv.getElementsAnnotatedWith(GenerateResourceBundleProperty2Javas.class)) - .thenReturn((Set)elements); - + .thenReturn((Set) elements); + processor.process(annotations, roundEnv); - - + + } }