Skip to content

Commit 6c4a8d5

Browse files
committed
Enable ECJ in Avaje Inject tests
1 parent d08c66c commit 6c4a8d5

File tree

1 file changed

+45
-25
lines changed
  • acceptance-tests/acceptance-tests-avaje-inject/src/test/groovy/io/github/ascopes/jct/acceptancetests/avajeinject

1 file changed

+45
-25
lines changed

acceptance-tests/acceptance-tests-avaje-inject/src/test/groovy/io/github/ascopes/jct/acceptancetests/avajeinject/AvajeInjectTest.groovy

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,63 @@
1515
*/
1616
package io.github.ascopes.jct.acceptancetests.avajeinject
1717

18+
import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
19+
1820
import io.github.ascopes.jct.compilers.JctCompiler
1921
import io.github.ascopes.jct.filemanagers.LoggingMode
22+
import io.github.ascopes.jct.junit.EcjCompilerTest
2023
import io.github.ascopes.jct.junit.JavacCompilerTest
24+
import io.github.ascopes.jct.workspaces.PathStrategy
25+
import io.github.ascopes.jct.workspaces.Workspace
2126
import io.github.ascopes.jct.workspaces.Workspaces
2227
import org.junit.jupiter.api.DisplayName
2328

24-
import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
25-
2629
@DisplayName("Avaje Inject acceptance tests")
2730
class AvajeInjectTest {
28-
@DisplayName("Dependency injection code gets generated as expected")
31+
@DisplayName("Dependency injection code gets generated as expected for Javac")
2932
@JavacCompilerTest(minVersion = 11)
30-
void dependencyInjectionCodeGetsGeneratedAsExpected(JctCompiler compiler) {
33+
void dependencyInjectionCodeGetsGeneratedAsExpectedForJavac(JctCompiler compiler) {
3134
// Given
3235
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+
}
4139

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)
5546
}
5647
}
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+
}
5777
}

0 commit comments

Comments
 (0)