Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:
env:
cache-name: maven-cache
with:
path:
~/.m2
path: ~/.m2
key: build-${{ env.cache-name }}

- name: Compile and run tests
Expand Down
5 changes: 5 additions & 0 deletions java-compiler-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
<artifactId>assertj-core</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
</dependency>

<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -26,6 +27,7 @@
class AvajeHttpTest {

@DisplayName("HTTP client code gets generated as expected")
@EcjCompilerTest(minVersion = 11)
@JavacCompilerTest(minVersion = 11)
void httpClientCodeGetsGeneratedAsExpected(JctCompiler compiler) {
// Given
Expand All @@ -40,7 +42,7 @@ void httpClientCodeGetsGeneratedAsExpected(JctCompiler compiler) {

// Then
assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings()
.isSuccessful()
.classOutputPackages()
.allFilesExist(
"org/example/httpclient/GeneratedHttpComponent.class",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.PathStrategy;
import io.github.ascopes.jct.workspaces.Workspaces;
Expand All @@ -27,6 +28,7 @@
class AvajeInjectTest {

@DisplayName("Dependency injection code gets generated as expected")
@EcjCompilerTest(minVersion = 11)
@JavacCompilerTest(minVersion = 11)
void dependencyInjectionCodeGetsGeneratedAsExpected(JctCompiler compiler) {
// Given
Expand All @@ -41,7 +43,7 @@ void dependencyInjectionCodeGetsGeneratedAsExpected(JctCompiler compiler) {

// Then
assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings()
.isSuccessful()
.classOutputPackages()
.allFilesExist(
"org/example/CoffeeMaker.class",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.avaje.jsonb.Jsonb;
import io.avaje.jsonb.generator.Processor;
import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import java.time.Instant;
Expand All @@ -30,6 +31,7 @@
@DisplayName("Avaje Jsonb acceptance tests")
class AvajeJsonbTest {
@DisplayName("JSON handling logic is generated as expected")
@EcjCompilerTest(minVersion = 11)
@JavacCompilerTest(minVersion = 11)
void jsonHandlingLogicIsGeneratedAsExpected(JctCompiler compiler) throws Throwable {
// Given
Expand All @@ -46,7 +48,7 @@ void jsonHandlingLogicIsGeneratedAsExpected(JctCompiler compiler) throws Throwab

// Then
assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings();
.isSuccessful();

var userClass = compilation
.getClassOutputs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import org.junit.jupiter.api.DisplayName;

@DisplayName("Dagger acceptance tests")
class DaggerTest {
@DisplayName("Dagger DI runs as expected in the annotation processing phase")
@EcjCompilerTest
@JavacCompilerTest
void daggerDiRunsAsExpectedInTheAnnotationProcessingPhase(JctCompiler compiler) {
try (var workspace = Workspaces.newWorkspace()) {
Expand All @@ -38,7 +40,7 @@ void daggerDiRunsAsExpectedInTheAnnotationProcessingPhase(JctCompiler compiler)
var compilation = compiler.compile(workspace);

// Then
assertThatCompilation(compilation).isSuccessfulWithoutWarnings();
assertThatCompilation(compilation).isSuccessful();

assertThatCompilation(compilation)
.sourceOutputPackages()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static io.github.ascopes.jct.assertions.JctAssertions.assertThat;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import java.io.IOException;
Expand Down Expand Up @@ -52,6 +53,7 @@ class JctDogfoodTest {
.resolve("classes");

@DisplayName("JCT can compile itself as a legacy module source")
@EcjCompilerTest(minVersion = 17, configurers = JctCompilationConfigurer.class)
@JavacCompilerTest(minVersion = 17, configurers = JctCompilationConfigurer.class)
void jctCanCompileItselfAsLegacyModule(JctCompiler compiler) throws IOException {
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.assertj.core.api.SoftAssertions.assertSoftly;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import java.time.Instant;
Expand All @@ -28,6 +29,7 @@
class AutoFactoryTest {

@DisplayName("The AutoFactory class is created as expected")
@EcjCompilerTest
@JavacCompilerTest
void autoFactoryClassIsCreatedAsExpected(JctCompiler compiler) throws Throwable {
try (var workspace = Workspaces.newWorkspace()) {
Expand All @@ -42,7 +44,7 @@ void autoFactoryClassIsCreatedAsExpected(JctCompiler compiler) throws Throwable

// Then
assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings()
.isSuccessful()
.classOutputPackages()
.fileExists("org", "example", "UserFactory.class")
.isNotEmptyFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -26,6 +27,7 @@
class AutoServiceTest {

@DisplayName("The AutoService descriptor is created as expected")
@EcjCompilerTest
@JavacCompilerTest
void autoServiceDescriptorIsCreatedAsExpected(JctCompiler compiler) {
try (var workspace = Workspaces.newWorkspace()) {
Expand All @@ -40,7 +42,7 @@ void autoServiceDescriptorIsCreatedAsExpected(JctCompiler compiler) {

// Then
assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings()
.isSuccessful()
.classOutputPackages()
.fileExists("META-INF", "services", "org.example.SomeInterface")
.hasContent("org.example.SomeImpl");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.assertj.core.api.SoftAssertions.assertSoftly;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import java.time.Instant;
Expand All @@ -29,6 +30,7 @@
class AutoValueTest {

@DisplayName("The AutoValue implementation class is created as expected")
@EcjCompilerTest
@JavacCompilerTest
void autoValueImplementationClassIsCreatedAsExpected(JctCompiler compiler) throws Throwable {
try (var workspace = Workspaces.newWorkspace()) {
Expand All @@ -43,7 +45,7 @@ void autoValueImplementationClassIsCreatedAsExpected(JctCompiler compiler) throw

// Then
assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings()
.isSuccessful()
.classOutputPackages()
.allFilesExist(
"org/example/AutoValue_User.class",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.assertj.core.api.SoftAssertions.assertSoftly;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import java.util.stream.Stream;
Expand All @@ -36,6 +37,7 @@
class ImmutablesTest {

@DisplayName("Immutables @Value produces the expected class")
@EcjCompilerTest
@JavacCompilerTest
void immutablesValueProducesTheExpectedClass(JctCompiler compiler) throws Throwable {
try (var workspace = Workspaces.newWorkspace()) {
Expand Down Expand Up @@ -68,6 +70,7 @@ void immutablesValueProducesTheExpectedClass(JctCompiler compiler) throws Throwa
}

@DisplayName("Immutables @Value produces the expected class for modules")
@EcjCompilerTest(minVersion = 9)
@JavacCompilerTest(minVersion = 9)
void immutablesValueProducesTheExpectedClassForModules(JctCompiler compiler) throws Throwable {
try (var workspace = Workspaces.newWorkspace()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.assertj.core.api.SoftAssertions.assertSoftly;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import java.util.stream.Stream;
Expand All @@ -28,6 +29,7 @@
class MapStructTest {

@DisplayName("MapStruct generates expected mapping code")
@EcjCompilerTest
@JavacCompilerTest
void mapStructGeneratesExpectedMappingCode(JctCompiler compiler) throws Throwable {
try (final var workspace = Workspaces.newWorkspace()) {
Expand All @@ -40,7 +42,7 @@ void mapStructGeneratesExpectedMappingCode(JctCompiler compiler) throws Throwabl
final var compilation = compiler.compile(workspace);

// Then
assertThatCompilation(compilation).isSuccessfulWithoutWarnings();
assertThatCompilation(compilation).isSuccessful();

final var classLoader = compilation.getFileManager()
.getClassLoader(StandardLocation.CLASS_OUTPUT);
Expand Down Expand Up @@ -68,6 +70,7 @@ void mapStructGeneratesExpectedMappingCode(JctCompiler compiler) throws Throwabl
}

@DisplayName("MapStruct generates expected mapping code for modules")
@EcjCompilerTest(minVersion = 9)
@JavacCompilerTest(minVersion = 9)
void mapStructGeneratesExpectedMappingCodeForModules(JctCompiler compiler) throws Throwable {
try (final var workspace = Workspaces.newWorkspace()) {
Expand All @@ -80,7 +83,7 @@ void mapStructGeneratesExpectedMappingCodeForModules(JctCompiler compiler) throw
final var compilation = compiler.compile(workspace);

// Then
assertThatCompilation(compilation).isSuccessfulWithoutWarnings();
assertThatCompilation(compilation).isSuccessful();

final var classLoader = compilation.getFileManager()
.getClassLoader(StandardLocation.CLASS_OUTPUT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation;

import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -26,6 +27,7 @@
class MicronautIntegrationTest {

@DisplayName("Micronaut generates the expected code")
@EcjCompilerTest(configurers = MicronautConfigurer.class)
@JavacCompilerTest(configurers = MicronautConfigurer.class)
void micronautGeneratesTheExpectedCode(JctCompiler compiler) {
try (var workspace = Workspaces.newWorkspace()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import io.github.ascopes.jct.acceptancetests.serviceloaderjpms.ServiceProcessor;
import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -27,6 +28,7 @@
class ServiceProcessorJpmsTest {

@DisplayName("Expected files get created when the processor is run")
@EcjCompilerTest(minVersion = 9)
@JavacCompilerTest(minVersion = 9)
void expectedFilesGetCreated(JctCompiler compiler) {
try (var workspace = Workspaces.newWorkspace()) {
Expand All @@ -41,7 +43,7 @@ void expectedFilesGetCreated(JctCompiler compiler) {
.compile(workspace);

assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings()
.isSuccessful()
.classOutputPackages()
.fileExists("META-INF", "services", "org.example.InsultProvider")
.hasContent("org.example.MeanInsultProviderImpl");
Expand All @@ -62,7 +64,7 @@ void expectedFilesGetCreatedInMultiModuleRoots(JctCompiler compiler) {
.compile(workspace);

assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings()
.isSuccessful()
.classOutputModules().moduleExists("org.example")
.fileExists("META-INF", "services", "org.example.InsultProvider")
.hasContent("org.example.MeanInsultProviderImpl");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import io.github.ascopes.jct.acceptancetests.serviceloader.ServiceProcessor;
import io.github.ascopes.jct.compilers.JctCompiler;
import io.github.ascopes.jct.junit.EcjCompilerTest;
import io.github.ascopes.jct.junit.JavacCompilerTest;
import io.github.ascopes.jct.workspaces.Workspaces;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -27,6 +28,7 @@
class ServiceProcessorTest {

@DisplayName("Expected files get created when the processor is run")
@EcjCompilerTest
@JavacCompilerTest
void expectedFilesGetCreated(JctCompiler compiler) {
try (var workspace = Workspaces.newWorkspace()) {
Expand All @@ -41,7 +43,7 @@ void expectedFilesGetCreated(JctCompiler compiler) {
.compile(workspace);

assertThatCompilation(compilation)
.isSuccessfulWithoutWarnings()
.isSuccessful()
.classOutputPackages()
.fileExists("META-INF", "services", "org.example.InsultProvider")
.hasContent("org.example.MeanInsultProviderImpl");
Expand Down
Loading
Loading