diff --git a/src/test/java/de/kreth/property2java/ConfigurationTest.java b/src/test/java/de/kreth/property2java/ConfigurationTest.java index c4f9e25..cdcafe3 100644 --- a/src/test/java/de/kreth/property2java/ConfigurationTest.java +++ b/src/test/java/de/kreth/property2java/ConfigurationTest.java @@ -16,18 +16,18 @@ import org.mockito.Mockito; class ConfigurationTest { - private Configuration config; + private TestImplConfig config; @BeforeEach void initConfig() { - config = Mockito.mock(Configuration.class); + config = Mockito.spy(TestImplConfig.class); } @Test void defaultWriterIsFileWriter() throws IOException { - when(config.outWriter(anyString())).thenCallRealMethod(); when(config.getRootPath()).thenReturn(new File(".").toPath()); + when(config.outWriter(anyString())).thenCallRealMethod(); when(config.mapFilenameToClassName(anyString())).thenCallRealMethod(); when(config.outputCharset()).thenCallRealMethod(); @@ -50,5 +50,4 @@ class ConfigurationTest { className = config.mapFilenameToClassName("application_en_US.properties"); assertEquals("Application_Properties", className); } - } diff --git a/src/test/java/de/kreth/property2java/GeneratorTests.java b/src/test/java/de/kreth/property2java/GeneratorTests.java index 1229b38..ae925b1 100644 --- a/src/test/java/de/kreth/property2java/GeneratorTests.java +++ b/src/test/java/de/kreth/property2java/GeneratorTests.java @@ -10,6 +10,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.io.File; import java.io.IOException; import java.io.Reader; import java.io.StringReader; @@ -26,6 +27,9 @@ import java.util.stream.Collectors; import org.hamcrest.Matchers; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +import de.kreth.property2java.processor.Format; class GeneratorTests { @@ -40,7 +44,9 @@ class GeneratorTests { Map input = new HashMap<>(); input.put(path, testProperties()); - config = mock(Configuration.class); + config = Mockito.spy(TestImplConfig.class); + when(config.getRootPath()).thenReturn(new File(".").toPath()); + when(config.getFormat()).thenReturn(Format.WithInitializer); when(config.getInput()).thenReturn(input); when(config.mapFilenameToClassName(anyString())).thenCallRealMethod(); when(config.outputCharset()).thenCallRealMethod(); diff --git a/src/test/java/de/kreth/property2java/TestImplConfig.java b/src/test/java/de/kreth/property2java/TestImplConfig.java new file mode 100644 index 0000000..6598dcd --- /dev/null +++ b/src/test/java/de/kreth/property2java/TestImplConfig.java @@ -0,0 +1,27 @@ +package de.kreth.property2java; + +import java.io.Reader; +import java.nio.file.Path; +import java.util.Map; + +class TestImplConfig implements Configuration { + + @Override + public String getPackage() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map getInput() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Path getRootPath() { + // TODO Auto-generated method stub + return null; + } + +} \ No newline at end of file