|
|
|
@ -2,14 +2,9 @@ package de.kreth.property2java; |
|
|
|
|
|
|
|
|
|
|
|
import static de.kreth.property2java.TestPropertiesSource.testProperties; |
|
|
|
import static de.kreth.property2java.TestPropertiesSource.testProperties; |
|
|
|
import static org.hamcrest.MatcherAssert.assertThat; |
|
|
|
import static org.hamcrest.MatcherAssert.assertThat; |
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue; |
|
|
|
|
|
|
|
import static org.mockito.ArgumentMatchers.anyString; |
|
|
|
import static org.mockito.ArgumentMatchers.anyString; |
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
import static org.mockito.Mockito.*; |
|
|
|
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.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
@ -25,6 +20,7 @@ import java.util.Optional; |
|
|
|
import java.util.StringTokenizer; |
|
|
|
import java.util.StringTokenizer; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.hamcrest.Matchers; |
|
|
|
import org.hamcrest.Matchers; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
@ -123,11 +119,11 @@ public class GeneratorWithInnerPropertiesTest { |
|
|
|
String load = null; |
|
|
|
String load = null; |
|
|
|
while (sourceTokenizer.hasMoreTokens()) { |
|
|
|
while (sourceTokenizer.hasMoreTokens()) { |
|
|
|
String line = sourceTokenizer.nextToken(); |
|
|
|
String line = sourceTokenizer.nextToken(); |
|
|
|
if (line.contains("Properties") |
|
|
|
if (line.contains("Properties") && |
|
|
|
&& !line.contains("import") |
|
|
|
!line.contains("import") && |
|
|
|
&& !line.contains("enum") |
|
|
|
!line.contains("enum") && |
|
|
|
&& !line.contains("@link") |
|
|
|
!line.contains("@link") && |
|
|
|
&& !line.contains("class")) { |
|
|
|
!line.contains("class")) { |
|
|
|
declaration = line; |
|
|
|
declaration = line; |
|
|
|
} else if (line.contains(".load")) { |
|
|
|
} else if (line.contains(".load")) { |
|
|
|
load = line; |
|
|
|
load = line; |
|
|
|
@ -143,7 +139,7 @@ public class GeneratorWithInnerPropertiesTest { |
|
|
|
Matchers.containsString("properties.load(Application_Properties.class.getResourceAsStream(\"/application.properties\"));")); |
|
|
|
Matchers.containsString("properties.load(Application_Properties.class.getResourceAsStream(\"/application.properties\"));")); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void testOneInputGeneratesOneOutput() throws IOException, GeneratorException { |
|
|
|
void testOneInputGeneratesOneOutput() throws IOException, GeneratorException { |
|
|
|
|
|
|
|
|
|
|
|
|