|
15 | 15 | */
|
16 | 16 | package io.github.ascopes.jct.acceptancetests.avajeinject
|
17 | 17 |
|
| 18 | +import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation |
| 19 | + |
18 | 20 | import io.github.ascopes.jct.compilers.JctCompiler
|
19 | 21 | import io.github.ascopes.jct.filemanagers.LoggingMode
|
| 22 | +import io.github.ascopes.jct.junit.EcjCompilerTest |
20 | 23 | import io.github.ascopes.jct.junit.JavacCompilerTest
|
| 24 | +import io.github.ascopes.jct.workspaces.PathStrategy |
| 25 | +import io.github.ascopes.jct.workspaces.Workspace |
21 | 26 | import io.github.ascopes.jct.workspaces.Workspaces
|
22 | 27 | import org.junit.jupiter.api.DisplayName
|
23 | 28 |
|
24 |
| -import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation |
25 |
| - |
26 | 29 | @DisplayName("Avaje Inject acceptance tests")
|
27 | 30 | class AvajeInjectTest {
|
28 |
| - @DisplayName("Dependency injection code gets generated as expected") |
| 31 | + @DisplayName("Dependency injection code gets generated as expected for Javac") |
29 | 32 | @JavacCompilerTest(minVersion = 11)
|
30 |
| - void dependencyInjectionCodeGetsGeneratedAsExpected(JctCompiler compiler) { |
| 33 | + void dependencyInjectionCodeGetsGeneratedAsExpectedForJavac(JctCompiler compiler) { |
31 | 34 | // Given
|
32 | 35 | try (def workspace = Workspaces.newWorkspace()) {
|
33 |
| - workspace |
34 |
| - .createSourcePathPackage() |
35 |
| - .copyContentsFrom("src", "test", "resources", "code") |
36 |
| - |
37 |
| - // When |
38 |
| - def compilation = compiler |
39 |
| - .diagnosticLoggingMode(LoggingMode.STACKTRACES) |
40 |
| - .compile(workspace) |
| 36 | + runTest(compiler, workspace) |
| 37 | + } |
| 38 | + } |
41 | 39 |
|
42 |
| - // Then |
43 |
| - assertThatCompilation(compilation) |
44 |
| - .isSuccessfulWithoutWarnings() |
45 |
| - .classOutput() |
46 |
| - .packages() |
47 |
| - .allFilesExist( |
48 |
| - 'org/example/CoffeeMaker.class', |
49 |
| - 'org/example/Grinder.class', |
50 |
| - 'org/example/Pump.class', |
51 |
| - 'org/example/CoffeeMaker$DI.class', |
52 |
| - 'org/example/Grinder$DI.class', |
53 |
| - 'org/example/Pump$DI.class', |
54 |
| - ) |
| 40 | + @DisplayName("Dependency injection code gets generated as expected for ECJ") |
| 41 | + @EcjCompilerTest(minVersion = 11) |
| 42 | + void dependencyInjectionCodeGetsGeneratedAsExpectedForEcj(JctCompiler compiler) { |
| 43 | + // Given |
| 44 | + try (def workspace = Workspaces.newWorkspace(PathStrategy.TEMP_DIRECTORIES)) { |
| 45 | + runTest(compiler, workspace) |
55 | 46 | }
|
56 | 47 | }
|
| 48 | + |
| 49 | + private static void runTest(JctCompiler compiler, Workspace workspace) { |
| 50 | + workspace |
| 51 | + .createSourcePathPackage() |
| 52 | + .copyContentsFrom("src", "test", "resources", "code") |
| 53 | + |
| 54 | + // When |
| 55 | + def compilation = compiler |
| 56 | + // TODO(ascopes): disable this |
| 57 | + .fileManagerLoggingMode(LoggingMode.ENABLED) |
| 58 | + .diagnosticLoggingMode(LoggingMode.STACKTRACES) |
| 59 | + .verbose(true) |
| 60 | + // end temporary block |
| 61 | + .compile(workspace) |
| 62 | + |
| 63 | + // Then |
| 64 | + assertThatCompilation(compilation) |
| 65 | + .isSuccessfulWithoutWarnings() |
| 66 | + .classOutput() |
| 67 | + .packages() |
| 68 | + .allFilesExist( |
| 69 | + 'org/example/CoffeeMaker.class', |
| 70 | + 'org/example/Grinder.class', |
| 71 | + 'org/example/Pump.class', |
| 72 | + 'org/example/CoffeeMaker$DI.class', |
| 73 | + 'org/example/Grinder$DI.class', |
| 74 | + 'org/example/Pump$DI.class', |
| 75 | + ) |
| 76 | + } |
57 | 77 | }
|
0 commit comments