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 7393a71..ed3eef5 100644 --- a/pom.xml +++ b/pom.xml @@ -12,8 +12,8 @@ UTF-8 17 5.3.0-M1 - 1.7.36 - 2.25.3 + 2.1.0-alpha1 + 3.0.0-beta2 ${maven.build.timestamp} yyyy-MM-dd HH:mm:ss @@ -100,19 +100,19 @@ org.junit.platform junit-platform-runner - 1.14.1 + 1.14.3 test org.mockito mockito-core - 5.21.0 + 5.22.0 test org.mockito mockito-junit-jupiter - 5.21.0 + 5.22.0 test @@ -146,7 +146,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.14.1 + 3.15.0 ${java.version} -proc:none diff --git a/src/test/java/de/kreth/property2java/GeneratorTests.java b/src/test/java/de/kreth/property2java/GeneratorTests.java index 421b136..9975844 100644 --- a/src/test/java/de/kreth/property2java/GeneratorTests.java +++ b/src/test/java/de/kreth/property2java/GeneratorTests.java @@ -213,17 +213,17 @@ class GeneratorTests { StringWriter out = new StringWriter(); Generator generator = new Generator(config, template); String fileName = "de.kreth.messages.properties"; - generator.generate(properties, out, fileName , config); - + generator.generate(properties, out, fileName, config); + @SuppressWarnings("unchecked") ArgumentCaptor> dataModelCaptor = ArgumentCaptor.forClass(Map.class); verify(template).process(dataModelCaptor.capture(), any(Writer.class)); assertThat(dataModelCaptor.getValue()) - .containsEntry("bundle_base_name", "de.kreth.messages") + .containsEntry("bundle_base_name", "de.kreth.messages") .containsEntry("fileName", fileName) .containsEntry("classname", "De_Kreth_Messages_Properties"); } - + @Test void testMainMethod() throws IOException, GeneratorException { Path source = Files.createTempFile(getClass().getSimpleName(), ".properties"); @@ -262,5 +262,5 @@ class GeneratorTests { return line.contains("\t" + key + " "); } - + } diff --git a/src/test/java/de/kreth/property2java/processor/ProcessorConfigurationTest.java b/src/test/java/de/kreth/property2java/processor/ProcessorConfigurationTest.java index ea0bc65..a9b77ed 100644 --- a/src/test/java/de/kreth/property2java/processor/ProcessorConfigurationTest.java +++ b/src/test/java/de/kreth/property2java/processor/ProcessorConfigurationTest.java @@ -6,7 +6,6 @@ import static org.mockito.Mockito.when; import java.io.IOException; import java.io.StringReader; - import javax.annotation.processing.Filer; import javax.lang.model.element.Name; import javax.lang.model.element.PackageElement; @@ -14,13 +13,13 @@ import javax.lang.model.element.TypeElement; import javax.tools.FileObject; import javax.tools.StandardLocation; + +import de.kreth.property2java.Format; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import de.kreth.property2java.Format; - @ExtendWith(MockitoExtension.class) public class ProcessorConfigurationTest { @@ -36,20 +35,21 @@ public class ProcessorConfigurationTest { String packageName = "de.kreth.pack.name"; String resourceName = "localization.properties"; FileObject fileObject = mock(FileObject.class); - StringReader input = new StringReader("key1=value1\n" - + "key2=value2"); - + StringReader input = new StringReader(""" + key1=value1 + key2=value2"""); + when(element.getEnclosingElement()).thenReturn(packageElement); when(packageElement.getQualifiedName()).thenReturn(name); when(name.toString()).thenReturn(packageName); when(filer.getResource(StandardLocation.CLASS_PATH, "", resourceName)).thenReturn(fileObject); when(fileObject.openReader(false)).thenReturn(input); - + ProcessorConfiguration config = new ProcessorConfiguration( ProcessorConfiguration.builder(filer, element) .withFormat(Format.WithInnerPropertyLoader) .addAll(resourceName)); - + assertThat(config.getPackage()).isEqualTo(packageName); } }