|
24 | 24 | import java.util.List; |
25 | 25 | import java.util.Map; |
26 | 26 |
|
| 27 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
27 | 28 | import static org.junit.jupiter.api.Assertions.assertTrue; |
28 | 29 | import org.junit.jupiter.api.Test; |
29 | 30 | import org.junit.jupiter.api.io.TempDir; |
@@ -61,16 +62,25 @@ public void testGenerateRock() throws IOException { |
61 | 62 | assertTrue(parts.containsKey("maven-cache")); |
62 | 63 | assertTrue(parts.containsKey("build-tool")); |
63 | 64 | } |
64 | | - Path buildFile = tempDir.toPath().resolve("build-maven.sh"); |
| 65 | + String result = readFile("build-maven.sh"); |
| 66 | + assertTrue(result.contains("GOAL=package"), "Goals should be replaced"); |
| 67 | + assertFalse(result.contains("!!")); |
| 68 | + |
| 69 | + result = readFile("build-gradle.sh"); |
| 70 | + assertFalse(result.contains("!!")); |
| 71 | + |
| 72 | + assertTrue(true, "The build should succeed"); |
| 73 | + } |
| 74 | + |
| 75 | + private String readFile(String file) throws IOException { |
| 76 | + Path buildFile = tempDir.toPath().resolve(file); |
| 77 | + StringBuilder result = new StringBuilder(); |
65 | 78 | try (BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(buildFile.toFile())))) { |
66 | | - StringBuilder result = new StringBuilder(); |
67 | 79 | String line; |
68 | 80 | while ((line = r.readLine())!= null){ |
69 | 81 | result.append(line); |
70 | 82 | } |
71 | | - assertTrue(result.toString().contains("GOAL=package"), "Goals should be replaced"); |
72 | 83 | } |
73 | | - |
74 | | - assertTrue(true, "The build should succeed"); |
| 84 | + return result.toString(); |
75 | 85 | } |
76 | 86 | } |
0 commit comments