Skip to content

Commit

Permalink
chore(processor): replace CI JRE condition by Junit conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
JoranVanBelle committed May 6, 2024
1 parent 4666a68 commit c01b909
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 14 deletions.
27 changes: 27 additions & 0 deletions processor/src/test/java/io/jonasg/bob/BobTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import java.util.List;

import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import io.toolisticon.cute.Cute;
import io.toolisticon.cute.CuteApi;
import io.toolisticon.cute.JavaFileObjectUtils;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

public class BobTests {

Expand Down Expand Up @@ -240,4 +243,28 @@ void allPublicSettersThatHaveCorrespondingFieldsAreBuildable() {
"/tests/AllPublicSettersThatHaveCorrespondingFieldsAreBuildable/Expected_AllPublicSettersThatHaveCorrespondingFieldsAreBuildable.java"))
.executeTest();
}

@Nested
class RecordTests {

@Test
@EnabledForJreRange(max = JRE.JAVA_11, disabledReason = "Records do not exist yet")
public void recordsAreBuildable() {
Cute.blackBoxTest()
.given()
.processors(List.of(BuildableProcessor.class))
.andSourceFiles("/tests/RecordsAreBuildable/RecordsAreBuildable.java")
.whenCompiled()
.thenExpectThat()
.compilationSucceeds()
.andThat()
.generatedSourceFile("io.jonasg.bob.test.RecordsAreBuildableBuilder")
.matches(
CuteApi.ExpectedFileObjectMatcherKind.BINARY,
JavaFileObjectUtils.readFromResource(
"/tests/RecordsAreBuildable/Expected_RecordsAreBuildable.java"))
.executeTest();
}

}
}
28 changes: 14 additions & 14 deletions processor/src/test/java/io/jonasg/bob/RecordsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
public class RecordsTest {

@Test
public void recordsAreBuildable() {
public void recordsAreBuildableWithStepwise() {
Cute.blackBoxTest()
.given()
.processors(List.of(BuildableProcessor.class))
.andSourceFiles("/tests/RecordsAreBuildable/RecordsAreBuildable.java")
.whenCompiled()
.thenExpectThat()
.compilationSucceeds()
.andThat()
.generatedSourceFile("io.jonasg.bob.test.RecordsAreBuildableBuilder")
.matches(
CuteApi.ExpectedFileObjectMatcherKind.BINARY,
JavaFileObjectUtils.readFromResource(
"/tests/RecordsAreBuildable/Expected_RecordsAreBuildable.java"))
.executeTest();
.given()
.processors(List.of(BuildableProcessor.class))
.andSourceFiles("/tests/RecordsAreBuildable/RecordsAreBuildable.java")
.whenCompiled()
.thenExpectThat()
.compilationSucceeds()
.andThat()
.generatedSourceFile("io.jonasg.bob.test.RecordsAreBuildableBuilder")
.matches(
CuteApi.ExpectedFileObjectMatcherKind.BINARY,
JavaFileObjectUtils.readFromResource(
"/tests/RecordsAreBuildable/Expected_RecordsAreBuildable.java"))
.executeTest();
}

}

0 comments on commit c01b909

Please sign in to comment.