From 18288d4567bf49a4e9f84576f7a5002e910ab594 Mon Sep 17 00:00:00 2001 From: Tobias Stamann Date: Fri, 9 Feb 2024 14:58:32 +0100 Subject: [PATCH] Upgrade to newest cute version --- .../__annotationName__ProcessorTest.java | 41 ++++++++++--------- .../resources/archetype-resources/pom.xml | 4 +- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/main/resources/archetype-resources/__rootArtifactId__-processor/src/test/java/processor/__annotationName__ProcessorTest.java b/src/main/resources/archetype-resources/__rootArtifactId__-processor/src/test/java/processor/__annotationName__ProcessorTest.java index b6253b8..ff5fa53 100644 --- a/src/main/resources/archetype-resources/__rootArtifactId__-processor/src/test/java/processor/__annotationName__ProcessorTest.java +++ b/src/main/resources/archetype-resources/__rootArtifactId__-processor/src/test/java/processor/__annotationName__ProcessorTest.java @@ -5,13 +5,11 @@ import io.toolisticon.aptk.tools.MessagerUtils; import io.toolisticon.aptk.tools.corematcher.CoreMatcherValidationMessages; -import io.toolisticon.cute.CompileTestBuilder; -import io.toolisticon.cute.JavaFileObjectUtils; +import io.toolisticon.cute.Cute; +import io.toolisticon.cute.CuteApi; import org.junit.Before; import org.junit.Test; -import javax.tools.JavaFileObject; -import javax.tools.StandardLocation; /** @@ -23,15 +21,16 @@ public class ${annotationName}ProcessorTest { - CompileTestBuilder.CompilationTestBuilder compileTestBuilder; + CuteApi.BlackBoxTestSourceFilesInterface compileTestBuilder; @Before public void init() { MessagerUtils.setPrintMessageCodes(true); - compileTestBuilder = CompileTestBuilder - .compilationTest() - .addProcessors(${annotationName}Processor.class); + compileTestBuilder = Cute + .blackBoxTest() + .given() + .processors(${annotationName}Processor.class); } @@ -39,8 +38,9 @@ public void init() { public void test_valid_usage() { compileTestBuilder - .addSources(JavaFileObjectUtils.readFromResource("testcases/TestcaseValidUsage.java")) - .compilationShouldSucceed() + .andSourceFiles("testcases/TestcaseValidUsage.java") + .whenCompiled() + .thenExpectThat().compilationSucceeds() .executeTest(); } @@ -48,9 +48,10 @@ public void test_valid_usage() { public void test_invalid_usage_with_empty_value() { compileTestBuilder - .addSources(JavaFileObjectUtils.readFromResource("testcases/TestcaseInvalidUsageWithEmptyValue.java")) - .compilationShouldFail() - .expectErrorMessageThatContains(${annotationName}ProcessorCompilerMessages.ERROR_VALUE_MUST_NOT_BE_EMPTY.getCode()) + .andSourceFiles("testcases/TestcaseInvalidUsageWithEmptyValue.java") + .whenCompiled() + .thenExpectThat().compilationFails() + .andThat().compilerMessage().ofKindError().contains(${annotationName}ProcessorCompilerMessages.ERROR_VALUE_MUST_NOT_BE_EMPTY.getCode()) .executeTest(); } @@ -58,9 +59,10 @@ public void test_invalid_usage_with_empty_value() { public void test_invalid_usage_on_enum() { compileTestBuilder - .addSources(JavaFileObjectUtils.readFromResource("testcases/TestcaseInvalidUsageOnEnum.java")) - .compilationShouldFail() - .expectErrorMessageThatContains(CoreMatcherValidationMessages.IS_CLASS.getCode()) + .andSourceFiles("testcases/TestcaseInvalidUsageOnEnum.java") + .whenCompiled() + .thenExpectThat().compilationFails() + .andThat().compilerMessage().ofKindError().contains(CoreMatcherValidationMessages.IS_CLASS.getCode()) .executeTest(); } @@ -68,9 +70,10 @@ public void test_invalid_usage_on_enum() { public void test_Test_invalid_usage_on_interface() { compileTestBuilder - .addSources(JavaFileObjectUtils.readFromResource("testcases/TestcaseInvalidUsageOnInterface.java")) - .compilationShouldFail() - .expectErrorMessageThatContains(CoreMatcherValidationMessages.IS_CLASS.getCode()) + .andSourceFiles("testcases/TestcaseInvalidUsageOnInterface.java") + .whenCompiled() + .thenExpectThat().compilationFails() + .andThat().compilerMessage().ofKindError().contains(CoreMatcherValidationMessages.IS_CLASS.getCode()) .executeTest(); } diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml index ebad0a0..3c82b5a 100644 --- a/src/main/resources/archetype-resources/pom.xml +++ b/src/main/resources/archetype-resources/pom.xml @@ -73,9 +73,9 @@ - 0.12.0 + 1.0.1 0.11.0 - 0.21.0 + 0.22.11 4.13.1