├── cute └── src │ ├── test │ ├── resources │ │ ├── compiletests │ │ │ ├── classpathtest │ │ │ │ ├── AR │ │ │ │ ├── BR │ │ │ │ └── resourceFile.txt │ │ │ ├── tata.txt │ │ │ ├── TestClass.java │ │ │ ├── javafileobjectutilstest │ │ │ │ └── JavaSourceFromResourceTestClass.java │ │ │ ├── withmultiplerelatedsourcefiles │ │ │ │ ├── JustOutput.java │ │ │ │ └── TestClassWithImplementedInterface.java │ │ │ ├── generatedclasstest │ │ │ │ └── TestClass.java │ │ │ ├── exceptionthrown │ │ │ │ └── ExceptionThrownUsecase.java │ │ │ ├── passintest │ │ │ │ ├── PassInTestClass.java │ │ │ │ ├── PassInTestClassMultipleAnnotatedWithoutPassIn.java │ │ │ │ └── PassInTestClassMultipleAnnotatedWithMultiplePassIn.java │ │ │ └── compileroptionstest │ │ │ │ └── Java8Code.java │ │ ├── TestClass.java │ │ ├── integrationtest │ │ │ ├── AnnotationProcessorAppliedTestClass.java │ │ │ └── CompiledClassesAndGeneratedFilesExistTestcase.java │ │ ├── BrokenTestClass.java │ │ ├── TestClassWithInnerClasses.java │ │ ├── TestClassWithImplementedInterface.java │ │ └── AnnotationProcessorUnitTestTestClass.java │ └── java │ │ └── io │ │ └── toolisticon │ │ └── cute │ │ ├── testcases │ │ ├── SimpleTestInterface.java │ │ ├── TestAnnotationProcessor.java │ │ └── TestAnnotationProcessorWithMissingNoArgConstructor.java │ │ ├── common │ │ ├── SimpleTestProcessor1Interface.java │ │ ├── ExceptionThrowerAnnotation.java │ │ ├── SimpleTestAnnotation2.java │ │ ├── SimpleTestAnnotation3.java │ │ ├── SimpleTestAnnotation1.java │ │ ├── SimpleTestProcessor2.java │ │ ├── SimpleTestProcessor3.java │ │ ├── ExceptionThrowerProcessor.java │ │ └── SimpleTestProcessor1.java │ │ ├── matchers │ │ ├── RegexGeneratedFileObjectMatcherTest.java │ │ ├── WellFormedXmlGerneratedFileObjectMatcherTest.java │ │ ├── BinaryGeneratedFileObjectMatcherTest.java │ │ ├── IgnoreLineEndingsGeneratedFileObjectMatcherTest.java │ │ ├── ContainsStringsGeneratedFileObjectMatcherTest.java │ │ └── CoreGeneratedFileObjectMatchersTest.java │ │ ├── TestUtilities.java │ │ ├── FileObjectUtilsTest.java │ │ ├── integrationtest │ │ └── ProcessorWasAppliedTest.java │ │ └── CompilerMessageCheckTest.java │ └── main │ ├── java │ └── io │ │ └── toolisticon │ │ └── cute │ │ ├── package-info.java │ │ ├── CuteClassLoader.java │ │ ├── GeneratedClassesTest.java │ │ ├── UnitTestBase.java │ │ ├── GeneratedClassesTestForSpecificClass.java │ │ ├── PassIn.java │ │ ├── InvalidTestConfigurationException.java │ │ ├── FailingAssertionException.java │ │ ├── TestAnnotation.java │ │ ├── UnitTestWithoutPassIn.java │ │ ├── GeneratedFileObjectMatcher.java │ │ ├── Java9SupportCheck.java │ │ ├── CommonUtilities.java │ │ ├── UnitTestForTestingAnnotationProcessorsWithoutPassIn.java │ │ ├── UnitTest.java │ │ ├── UnitTestForTestingAnnotationProcessors.java │ │ ├── matchers │ │ ├── ContainsStringsGeneratedFileObjectMatcher.java │ │ ├── RegexGeneratedFileObjectMatcher.java │ │ ├── WellFormedXmlGeneratedFileObjectMatcher.java │ │ ├── BinaryGeneratedFileObjectMatcher.java │ │ ├── CoreGeneratedFileObjectMatchers.java │ │ └── IgnoreLineEndingsGeneratedFileObjectMatcher.java │ │ ├── UnitTestAnnotationProcessorClassWithPassIn.java │ │ ├── CompilationResult.java │ │ ├── UnitTestAnnotationProcessorClassWithoutPassIn.java │ │ ├── UnitTestAnnotationProcessorClass.java │ │ ├── CuteClassLoaderImpl.java │ │ ├── AbstractUnitTestAnnotationProcessorClass.java │ │ ├── UnitTestAnnotationProcessorClassForTestingAnnotationProcessorsWithoutPassIn.java │ │ ├── UnitTestAnnotationProcessorClassForTestingAnnotationProcessorsWithPassIn.java │ │ ├── UnitTestAnnotationProcessorClassForTestingAnnotationProcessors.java │ │ ├── CompileTestUtilities.java │ │ └── AbstractUnitTestAnnotationProcessorWithPassIn.java │ └── resources │ └── AnnotationProcessorUnitTestClass.java ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .gitignore ├── legacy ├── src │ └── test │ │ ├── resources │ │ └── compiletests │ │ │ ├── TestClass.java │ │ │ ├── javafileobjectutilstest │ │ │ └── JavaSourceFromResourceTestClass.java │ │ │ └── passintest │ │ │ ├── PassInTestClass.java │ │ │ ├── PassInTestClassMultipleAnnotatedWithoutPassIn.java │ │ │ └── PassInTestClassMultipleAnnotatedWithMultiplePassIn.java │ │ └── java │ │ └── io │ │ └── toolisticon │ │ └── cute │ │ └── common │ │ ├── SimpleTestAnnotation1.java │ │ ├── SimpleTestAnnotation2.java │ │ ├── SimpleTestAnnotation3.java │ │ ├── SimpleTestProcessor2.java │ │ ├── SimpleTestProcessor3.java │ │ └── SimpleTestProcessor1.java └── pom.xml ├── doRelease.sh ├── config └── findbugs-excludes.xml ├── integration-test ├── java9 │ ├── regularTestModule │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ ├── module-info.java │ │ │ │ └── io │ │ │ │ └── toolisticon │ │ │ │ └── cute │ │ │ │ └── integrationtest │ │ │ │ └── javanine │ │ │ │ └── regularmodule │ │ │ │ ├── notexported │ │ │ │ └── NotExportedClass.java │ │ │ │ └── RegularModuleTestClass.java │ │ ├── pom.xml │ │ └── pom.xml.releaseBackup │ ├── test │ │ ├── src │ │ │ └── test │ │ │ │ ├── resources │ │ │ │ └── testcases │ │ │ │ │ ├── unitTest │ │ │ │ │ ├── module-info.java │ │ │ │ │ └── Test.java │ │ │ │ │ ├── bindNamedAutomaticJavaModule │ │ │ │ │ ├── module-info.java │ │ │ │ │ └── Test.java │ │ │ │ │ ├── accessNotExportedClass │ │ │ │ │ ├── module-info.java │ │ │ │ │ └── Test.java │ │ │ │ │ ├── bindRegularJavaModule │ │ │ │ │ ├── module-info.java │ │ │ │ │ └── Test.java │ │ │ │ │ └── bindUnnamedAutomaticJavaModule │ │ │ │ │ ├── module-info.java │ │ │ │ │ └── Test.java │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── toolisticon │ │ │ │ └── cute │ │ │ │ └── integrationtest │ │ │ │ └── java9 │ │ │ │ └── IntegrationTest.java │ │ ├── pom.xml │ │ └── pom.xml.releaseBackup │ ├── namedAutomaticModule │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── toolisticon │ │ │ │ └── cute │ │ │ │ └── integrationtest │ │ │ │ └── javanine │ │ │ │ └── namednonmodule │ │ │ │ └── NamedAutomaticModuleTestClass.java │ │ ├── pom.xml │ │ └── pom.xml.releaseBackup │ ├── unnamedAutomaticModule │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── toolisticon │ │ │ │ └── cute │ │ │ │ └── integrationtest │ │ │ │ └── javanine │ │ │ │ └── unnamednonmodule │ │ │ │ └── UnnamedAutomaticModuleTestClass.java │ │ ├── pom.xml │ │ └── pom.xml.releaseBackup │ ├── pom.xml │ └── pom.xml.releaseBackup ├── junit4 │ ├── pom.xml │ ├── pom.xml.releaseBackup │ └── src │ │ └── test │ │ └── java │ │ └── io │ │ └── toolisticon │ │ └── cute │ │ └── integrationtest │ │ └── junit4 │ │ └── Junit4Test.java ├── testng │ ├── pom.xml │ ├── pom.xml.releaseBackup │ └── src │ │ └── test │ │ └── java │ │ └── io │ │ └── toolisticon │ │ └── cute │ │ └── integrationtest │ │ └── testng │ │ └── TestNgTest.java ├── junit5 │ ├── pom.xml │ ├── pom.xml.releaseBackup │ └── src │ │ └── test │ │ └── java │ │ └── io │ │ └── toolisticon │ │ └── cute │ │ └── integrationtest │ │ └── junit5 │ │ └── Junit5Test.java ├── pom.xml └── pom.xml.releaseBackup ├── extension ├── api │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── toolisticon │ │ │ └── cute │ │ │ └── extension │ │ │ └── api │ │ │ ├── ModuleSupportSpi.java │ │ │ └── AssertionSpi.java │ ├── pom.xml │ └── pom.xml.releaseBackup ├── testng │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── toolisticon │ │ │ │ └── cute │ │ │ │ └── extension │ │ │ │ └── testng │ │ │ │ └── TestNGAssertion.java │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── toolisticon │ │ │ └── cute │ │ │ └── extension │ │ │ └── testng │ │ │ └── TestNGAssertionTest.java │ └── pom.xml ├── junit5 │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── toolisticon │ │ │ │ └── cute │ │ │ │ └── extension │ │ │ │ └── junit5 │ │ │ │ └── JUnit5Assertion.java │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── toolisticon │ │ │ └── cute │ │ │ └── extension │ │ │ └── junit5 │ │ │ └── JUnit5AssertionTest.java │ └── pom.xml ├── plainjava │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── toolisticon │ │ │ │ └── cute │ │ │ │ └── extension │ │ │ │ └── plainjava │ │ │ │ └── AssertionErrorAssertion.java │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── toolisticon │ │ │ └── cute │ │ │ └── extension │ │ │ └── plainjava │ │ │ └── AssertionErrorAssertionTest.java │ └── pom.xml ├── junit4 │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── toolisticon │ │ │ │ └── cute │ │ │ │ └── extension │ │ │ │ └── junit4 │ │ │ │ └── JUnit4Assertion.java │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── toolisticon │ │ │ └── cute │ │ │ └── extension │ │ │ └── junit4 │ │ │ └── JUnit4AssertionTest.java │ └── pom.xml ├── pom.xml ├── pom.xml.releaseBackup └── modulesupport │ └── pom.xml ├── .github └── workflows │ ├── default.yml │ ├── jacoco.yml │ └── release.yml ├── LICENSE └── coverage ├── pom.xml └── pom.xml.releaseBackup /cute/src/test/resources/compiletests/classpathtest/AR: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/classpathtest/BR: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/tata.txt: -------------------------------------------------------------------------------- 1 | TATA! -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/classpathtest/resourceFile.txt: -------------------------------------------------------------------------------- 1 | TATA! -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toolisticon/cute/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/TestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper; 2 | 3 | public class TestClass { 4 | 5 | } 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build and Release Folders 2 | target 3 | .settings 4 | .project 5 | .classpath 6 | *.iml 7 | .idea 8 | atlassian-ide-plugin.xml 9 | *.factorypath 10 | -------------------------------------------------------------------------------- /legacy/src/test/resources/compiletests/TestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper; 2 | 3 | public class TestClass { 4 | 5 | } 6 | 7 | -------------------------------------------------------------------------------- /doRelease.sh: -------------------------------------------------------------------------------- 1 | ./mvnw -B -Darguments="-Dmaven.deploy.skip=true" -Dmaven.test.skip=true -Dresume=false -DreleaseVersion=$1 -DdevelopmentVersion=$2 release:prepare release:perform 2 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/testcases/SimpleTestInterface.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.testcases; 2 | 3 | public interface SimpleTestInterface { 4 | String saySomething(); 5 | } 6 | -------------------------------------------------------------------------------- /config/findbugs-excludes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package contains all public classes and interfaces intentioned to be used as part of the public api. 3 | */ 4 | package io.toolisticon.cute; -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/SimpleTestProcessor1Interface.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | public interface SimpleTestProcessor1Interface { 4 | String getOutput (); 5 | } 6 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/CuteClassLoader.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | public interface CuteClassLoader { 4 | 5 | Class getClass(String binaryClassName) throws ClassNotFoundException; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /integration-test/java9/regularTestModule/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module io.toolisticon.cute.integrationtest.javanine.regularmodule { 2 | 3 | exports io.toolisticon.cute.integrationtest.javanine.regularmodule; 4 | 5 | } -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/GeneratedClassesTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | public interface GeneratedClassesTest { 4 | 5 | void doTests(CuteClassLoader cuteClassLoader) throws Exception; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/unitTest/module-info.java: -------------------------------------------------------------------------------- 1 | module io.toolisticon.cute.integrationtest.javanine { 2 | exports io.toolisticon.cute.integrationtest.javanine; 3 | requires cute; 4 | } 5 | 6 | -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/javafileobjectutilstest/JavaSourceFromResourceTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper.compiletest; 2 | 3 | public class JavaSourceFromResourceTestClass { 4 | 5 | 6 | 7 | } -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/withmultiplerelatedsourcefiles/JustOutput.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | public class JustOutput { 4 | 5 | public static String getString() { 6 | return "WHATS UP???"; 7 | } 8 | } -------------------------------------------------------------------------------- /legacy/src/test/resources/compiletests/javafileobjectutilstest/JavaSourceFromResourceTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper.compiletest; 2 | 3 | public class JavaSourceFromResourceTestClass { 4 | 5 | 6 | 7 | } -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestBase.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | /** 4 | * Base interface used to store unit tests in backing bean. 5 | * Will be later handled via instanceof. 6 | */ 7 | public interface UnitTestBase { 8 | } 9 | -------------------------------------------------------------------------------- /cute/src/test/resources/TestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import io.toolisticon.cute.TestAnnotation; 4 | 5 | /** 6 | * Test class for annotation processor tools. 7 | */ 8 | @TestAnnotation 9 | public class TestClass { 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/GeneratedClassesTestForSpecificClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | public interface GeneratedClassesTestForSpecificClass { 4 | 5 | void doTests(Class clazz, CuteClassLoader cuteClassLoader) throws Exception; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /integration-test/java9/regularTestModule/src/main/java/io/toolisticon/cute/integrationtest/javanine/regularmodule/notexported/NotExportedClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine.regularmodule.notexported; 2 | 3 | public class NotExportedClass { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /cute/src/test/resources/integrationtest/AnnotationProcessorAppliedTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest; 2 | 3 | import io.toolisticon.cute.common.SimpleTestAnnotation1; 4 | 5 | @SimpleTestAnnotation1 6 | public class AnnotationProcessorAppliedTestClass { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /cute/src/test/resources/integrationtest/CompiledClassesAndGeneratedFilesExistTestcase.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest; 2 | 3 | import io.toolisticon.cute.common.SimpleTestAnnotation1; 4 | 5 | @SimpleTestAnnotation1 6 | public class CompiledClassesAndGeneratedFilesExistTestcase { 7 | 8 | 9 | } -------------------------------------------------------------------------------- /cute/src/test/resources/BrokenTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import io.toolisticon.cute.TestAnnotation; 4 | 5 | /** 6 | * Test class for annotation processor tools. 7 | */ 8 | @TestAnnotation 9 | public class BrokenTestClass { 10 | // invalid code => leads to compiler error 11 | sdasdasd 12 | } 13 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/PassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | /** 7 | * Annotation to mark elements to pass into unit test. 8 | */ 9 | @Retention(RetentionPolicy.RUNTIME) 10 | 11 | public @interface PassIn { 12 | } 13 | -------------------------------------------------------------------------------- /integration-test/java9/regularTestModule/src/main/java/io/toolisticon/cute/integrationtest/javanine/regularmodule/RegularModuleTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine.regularmodule; 2 | 3 | public class RegularModuleTestClass { 4 | 5 | public String testMethod() { 6 | return "OK"; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /integration-test/java9/namedAutomaticModule/src/main/java/io/toolisticon/cute/integrationtest/javanine/namednonmodule/NamedAutomaticModuleTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine.namednonmodule; 2 | 3 | public class NamedAutomaticModuleTestClass { 4 | 5 | public String testMethod() { 6 | return "OK"; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/bindNamedAutomaticJavaModule/module-info.java: -------------------------------------------------------------------------------- 1 | module io.toolisticon.cute.integrationtest.javanine { 2 | requires java.compiler; 3 | requires java.logging; 4 | requires transitive integration.test.javanine.namedautomaticmodule; 5 | 6 | exports io.toolisticon.cute.integrationtest.javanine; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/generatedclasstest/TestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.testhelper.compiletest; 2 | 3 | import io.toolisticon.cute.common.SimpleTestAnnotation1; 4 | import io.toolisticon.cute.common.SimpleTestAnnotation2; 5 | 6 | @SimpleTestAnnotation1("WORKS!!!") 7 | @SimpleTestAnnotation2 8 | public class TestClass { 9 | 10 | 11 | 12 | } -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/accessNotExportedClass/module-info.java: -------------------------------------------------------------------------------- 1 | module io.toolisticon.cute.integrationtest.javanine { 2 | requires java.compiler; 3 | requires java.logging; 4 | requires transitive io.toolisticon.cute.integrationtest.javanine.regularmodule; 5 | 6 | exports io.toolisticon.cute.integrationtest.javanine; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/bindRegularJavaModule/module-info.java: -------------------------------------------------------------------------------- 1 | module io.toolisticon.cute.integrationtest.javanine { 2 | requires java.compiler; 3 | requires java.logging; 4 | requires transitive io.toolisticon.cute.integrationtest.javanine.regularmodule; 5 | 6 | exports io.toolisticon.cute.integrationtest.javanine; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /integration-test/java9/unnamedAutomaticModule/src/main/java/io/toolisticon/cute/integrationtest/javanine/unnamednonmodule/UnnamedAutomaticModuleTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine.unnamednonmodule; 2 | 3 | public class UnnamedAutomaticModuleTestClass { 4 | 5 | public String testMethod() { 6 | return "OK"; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /cute/src/main/resources/AnnotationProcessorUnitTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.compiletesting.test; 2 | 3 | import io.toolisticon.cute.TestAnnotation; 4 | 5 | /** 6 | * Test class for annotation processor tools. 7 | * Useed for as the entry point for executing unit tests. 8 | */ 9 | @TestAnnotation 10 | public class AnnotationProcessorUnitTestClass { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/exceptionthrown/ExceptionThrownUsecase.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.testhelper.compiletest; 2 | 3 | import io.toolisticon.cute.common.ExceptionThrowerAnnotation; 4 | import io.toolisticon.cute.common.SimpleTestAnnotation1; 5 | 6 | @ExceptionThrowerAnnotation 7 | @SimpleTestAnnotation1 8 | public class ExceptionThrownUsecase { 9 | 10 | } -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/bindUnnamedAutomaticJavaModule/module-info.java: -------------------------------------------------------------------------------- 1 | 2 | module io.toolisticon.cute.integrationtest.javanine { 3 | requires java.compiler; 4 | requires java.logging; 5 | requires transitive integration.test.javanine.unnamedautomaticmodule; 6 | 7 | exports io.toolisticon.cute.integrationtest.javanine; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/InvalidTestConfigurationException.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | /** 4 | * Exception thrown in case of an configuration error. 5 | */ 6 | public class InvalidTestConfigurationException extends RuntimeException { 7 | 8 | public InvalidTestConfigurationException(String message) { 9 | super(message); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/unitTest/Test.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine; 2 | 3 | import io.toolisticon.cute.PassIn; 4 | 5 | @PassIn 6 | public class Test { 7 | 8 | public static void testCall() { 9 | 10 | } 11 | 12 | public static void secondTestCall(String testClass) { 13 | 14 | } 15 | 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/passintest/PassInTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper.compiletest; 2 | 3 | import io.toolisticon.cute.PassIn; 4 | import io.toolisticon.cute.TestAnnotation; 5 | 6 | @TestAnnotation 7 | public class PassInTestClass { 8 | 9 | @PassIn 10 | @TestAnnotation 11 | public static class InnerTestClass { 12 | 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /legacy/src/test/resources/compiletests/passintest/PassInTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper.compiletest; 2 | 3 | import io.toolisticon.cute.PassIn; 4 | import io.toolisticon.cute.TestAnnotation; 5 | 6 | @TestAnnotation 7 | public class PassInTestClass { 8 | 9 | @PassIn 10 | @TestAnnotation 11 | public static class InnerTestClass { 12 | 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/ExceptionThrowerAnnotation.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface ExceptionThrowerAnnotation { 11 | } 12 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/SimpleTestAnnotation2.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Target(ElementType.TYPE) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface SimpleTestAnnotation2 { 12 | } 13 | -------------------------------------------------------------------------------- /legacy/src/test/java/io/toolisticon/cute/common/SimpleTestAnnotation1.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Target(ElementType.TYPE) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface SimpleTestAnnotation1 { 12 | } 13 | -------------------------------------------------------------------------------- /legacy/src/test/java/io/toolisticon/cute/common/SimpleTestAnnotation2.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Target(ElementType.TYPE) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface SimpleTestAnnotation2 { 12 | } 13 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/SimpleTestAnnotation3.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | @Target(ElementType.TYPE) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface SimpleTestAnnotation3 { 12 | } 13 | 14 | -------------------------------------------------------------------------------- /legacy/src/test/java/io/toolisticon/cute/common/SimpleTestAnnotation3.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | @Target(ElementType.TYPE) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface SimpleTestAnnotation3 { 12 | } 13 | 14 | -------------------------------------------------------------------------------- /legacy/src/test/resources/compiletests/passintest/PassInTestClassMultipleAnnotatedWithoutPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper.compiletest; 2 | 3 | import io.toolisticon.cute.PassIn; 4 | import io.toolisticon.cute.TestAnnotation; 5 | 6 | @PassIn 7 | public class PassInTestClassMultipleAnnotatedWithoutPassIn { 8 | 9 | @PassIn 10 | public static class InnerTestClass { 11 | 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/compileroptionstest/Java8Code.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.testcases; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.List; 6 | import java.util.stream.Collectors; 7 | 8 | public class Java8Code { 9 | public static void main(String[] args) { 10 | Arrays.asList("A", "B", "C").stream().filter(e -> e.equals("B")).collect(Collectors.toSet()); 11 | } 12 | } -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/passintest/PassInTestClassMultipleAnnotatedWithoutPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper.compiletest; 2 | 3 | import io.toolisticon.cute.PassIn; 4 | import io.toolisticon.cute.TestAnnotation; 5 | 6 | @TestAnnotation 7 | public class PassInTestClassMultipleAnnotatedWithoutPassIn { 8 | 9 | @TestAnnotation 10 | public static class InnerTestClass { 11 | 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/SimpleTestAnnotation1.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Target(ElementType.TYPE) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface SimpleTestAnnotation1 { 12 | String value() default ""; 13 | } 14 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/FailingAssertionException.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | /** 4 | * Exception to signal failing Assertion 5 | */ 6 | public class FailingAssertionException extends RuntimeException { 7 | 8 | public FailingAssertionException(String message) { 9 | super(message); 10 | } 11 | 12 | public FailingAssertionException(String message, Throwable e) { 13 | super(message,e); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/TestAnnotation.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * This is the annotation for the default unit test processor. 10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(value = ElementType.TYPE) 13 | public @interface TestAnnotation { 14 | } 15 | -------------------------------------------------------------------------------- /cute/src/test/resources/TestClassWithInnerClasses.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import io.toolisticon.cute.TestAnnotation; 4 | 5 | /** 6 | * Test class for annotation processor tools. 7 | */ 8 | @TestAnnotation 9 | public class TestClassWithInnerClasses { 10 | 11 | public class InnerClass { 12 | 13 | } 14 | 15 | public static class StaticInnerClass { 16 | 17 | 18 | } 19 | 20 | public interface InnerInterface { 21 | 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/passintest/PassInTestClassMultipleAnnotatedWithMultiplePassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper.compiletest; 2 | 3 | import io.toolisticon.cute.PassIn; 4 | import io.toolisticon.cute.TestAnnotation; 5 | 6 | @PassIn 7 | @TestAnnotation 8 | public class PassInTestClassMultipleAnnotatedWithMultiplePassIn { 9 | 10 | @PassIn 11 | @TestAnnotation 12 | public static class InnerTestClass { 13 | 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /legacy/src/test/resources/compiletests/passintest/PassInTestClassMultipleAnnotatedWithMultiplePassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.annotationprocessortoolkit.testhelper.compiletest; 2 | 3 | import io.toolisticon.cute.PassIn; 4 | import io.toolisticon.cute.TestAnnotation; 5 | 6 | @PassIn 7 | @TestAnnotation 8 | public class PassInTestClassMultipleAnnotatedWithMultiplePassIn { 9 | 10 | @PassIn 11 | @TestAnnotation 12 | public static class InnerTestClass { 13 | 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /cute/src/test/resources/TestClassWithImplementedInterface.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import io.toolisticon.cute.TestAnnotation; 4 | import io.toolisticon.cute.testcases.SimpleTestInterface; 5 | 6 | /** 7 | * Test class for annotation processor tools. 8 | */ 9 | @TestAnnotation 10 | public class TestClassWithImplementedInterface implements SimpleTestInterface { 11 | 12 | @Override 13 | public String saySomething() { 14 | return "WHATS UP?"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cute/src/test/resources/compiletests/withmultiplerelatedsourcefiles/TestClassWithImplementedInterface.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import io.toolisticon.cute.TestAnnotation; 4 | import io.toolisticon.cute.testcases.SimpleTestInterface; 5 | 6 | /** 7 | * Test class for annotation processor tools. 8 | */ 9 | @TestAnnotation 10 | public class TestClassWithImplementedInterface implements SimpleTestInterface { 11 | 12 | @Override 13 | public String saySomething() { 14 | return JustOutput.getString(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/bindRegularJavaModule/Test.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine; 2 | 3 | import io.toolisticon.cute.integrationtest.javanine.regularmodule.RegularModuleTestClass; 4 | 5 | import javax.annotation.processing.Processor; 6 | 7 | public class Test { 8 | 9 | public static void testCall(Processor processor) { 10 | 11 | } 12 | 13 | public static void secondTestCall(RegularModuleTestClass testClass) { 14 | testClass.testMethod(); 15 | } 16 | 17 | 18 | } 19 | 20 | -------------------------------------------------------------------------------- /extension/api/src/main/java/io/toolisticon/cute/extension/api/ModuleSupportSpi.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.api; 2 | 3 | import io.toolisticon.spiap.api.Spi; 4 | 5 | import javax.tools.JavaCompiler; 6 | import javax.tools.StandardJavaFileManager; 7 | import java.util.Set; 8 | 9 | @Spi 10 | public interface ModuleSupportSpi { 11 | 12 | void applyModulePath(StandardJavaFileManager stdJavaFileManager, JavaCompiler.CompilationTask compilationTask, Set modules); 13 | 14 | void writeModuleDebugOutput(StringBuilder stringBuilder); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/bindNamedAutomaticJavaModule/Test.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine; 2 | 3 | import io.toolisticon.cute.integrationtest.javanine.namednonmodule.NamedAutomaticModuleTestClass; 4 | 5 | import javax.annotation.processing.Processor; 6 | 7 | public class Test { 8 | 9 | public static void testCall(Processor processor) { 10 | 11 | } 12 | 13 | public static void secondTestCall(NamedAutomaticModuleTestClass testClass) { 14 | testClass.testMethod(); 15 | } 16 | 17 | 18 | } 19 | 20 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/bindUnnamedAutomaticJavaModule/Test.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine; 2 | 3 | import io.toolisticon.cute.integrationtest.javanine.unnamednonmodule.UnnamedAutomaticModuleTestClass; 4 | 5 | import javax.annotation.processing.Processor; 6 | 7 | public class Test { 8 | 9 | public static void testCall(Processor processor) { 10 | 11 | } 12 | 13 | public static void secondTestCall(UnnamedAutomaticModuleTestClass testClass) { 14 | testClass.testMethod(); 15 | } 16 | 17 | 18 | } 19 | 20 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestWithoutPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.ProcessingEnvironment; 4 | 5 | /** 6 | * Interface that is used during unit test creation. It allows setting up a unit test without the need to create a valid annotation processor. 7 | * 8 | * Please use {@link UnitTestForTestingAnnotationProcessors} if you want to unit test annotation processor methods. 9 | */ 10 | public interface UnitTestWithoutPassIn extends UnitTestBase{ 11 | 12 | /** 13 | * The unit test method. 14 | * 15 | * @param processingEnvironment the processingEnvironment 16 | */ 17 | void unitTest(ProcessingEnvironment processingEnvironment); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/resources/testcases/accessNotExportedClass/Test.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.javanine; 2 | 3 | import io.toolisticon.cute.integrationtest.javanine.regularmodule.RegularModuleTestClass; 4 | import io.toolisticon.cute.integrationtest.javanine.regularmodule.notexported.NotExportedClass; 5 | 6 | import javax.annotation.processing.Processor; 7 | 8 | public class Test { 9 | 10 | final static NotExportedClass instance = new NotExportedClass(); 11 | 12 | public static void testCall(Processor processor) { 13 | 14 | } 15 | 16 | public static void secondTestCall(RegularModuleTestClass testClass) { 17 | testClass.testMethod(); 18 | } 19 | 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/testcases/TestAnnotationProcessor.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.testcases; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.RoundEnvironment; 5 | import javax.annotation.processing.SupportedAnnotationTypes; 6 | import javax.lang.model.element.TypeElement; 7 | import java.util.Set; 8 | 9 | /** 10 | * Test annotation processor. Does nothing. 11 | */ 12 | 13 | @SupportedAnnotationTypes("io.toolisticon.cute.TestAnnotation") 14 | public class TestAnnotationProcessor extends AbstractProcessor { 15 | 16 | @Override 17 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 18 | return false; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/GeneratedFileObjectMatcher.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.tools.FileObject; 4 | import java.io.IOException; 5 | 6 | /** 7 | * Interface to allow custom checks in fluent api. 8 | * 9 | */ 10 | public interface GeneratedFileObjectMatcher { 11 | 12 | /** 13 | * Method to check 14 | * 15 | * @param fileObject the file object to check 16 | * @return true if check is done successfully, otherwise false 17 | * @throws IOException might be thrown during access of passed fileObject 18 | * @throws FailingAssertionException can be thrown to provide a detailed assertion message in case of a failing assertion. 19 | */ 20 | boolean check(FileObject fileObject) throws IOException; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/SimpleTestProcessor2.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.RoundEnvironment; 5 | import javax.lang.model.element.TypeElement; 6 | import java.util.Arrays; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | public class SimpleTestProcessor2 extends AbstractProcessor { 11 | @Override 12 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 13 | return false; 14 | } 15 | 16 | @Override 17 | public Set getSupportedAnnotationTypes() { 18 | 19 | return new HashSet(Arrays.asList(SimpleTestAnnotation2.class.getCanonicalName())); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/SimpleTestProcessor3.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.RoundEnvironment; 5 | import javax.lang.model.element.TypeElement; 6 | import java.util.Arrays; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | public class SimpleTestProcessor3 extends AbstractProcessor { 11 | @Override 12 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 13 | return false; 14 | } 15 | 16 | @Override 17 | public Set getSupportedAnnotationTypes() { 18 | 19 | return new HashSet(Arrays.asList(SimpleTestAnnotation3.class.getCanonicalName())); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /legacy/src/test/java/io/toolisticon/cute/common/SimpleTestProcessor2.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.RoundEnvironment; 5 | import javax.lang.model.element.TypeElement; 6 | import java.util.Arrays; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | public class SimpleTestProcessor2 extends AbstractProcessor { 11 | @Override 12 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 13 | return false; 14 | } 15 | 16 | @Override 17 | public Set getSupportedAnnotationTypes() { 18 | 19 | return new HashSet(Arrays.asList(SimpleTestAnnotation2.class.getCanonicalName())); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /legacy/src/test/java/io/toolisticon/cute/common/SimpleTestProcessor3.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.RoundEnvironment; 5 | import javax.lang.model.element.TypeElement; 6 | import java.util.Arrays; 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | public class SimpleTestProcessor3 extends AbstractProcessor { 11 | @Override 12 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 13 | return false; 14 | } 15 | 16 | @Override 17 | public Set getSupportedAnnotationTypes() { 18 | 19 | return new HashSet(Arrays.asList(SimpleTestAnnotation3.class.getCanonicalName())); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.github/workflows/default.yml: -------------------------------------------------------------------------------- 1 | name: default 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | - '**/*' 8 | - '!master' 9 | 10 | jobs: 11 | build: 12 | runs-on: ${{ matrix.os }} 13 | strategy: 14 | matrix: 15 | os: [ ubuntu-latest,macos-latest,windows-latest ] 16 | java: [ 8, 11, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23 ] 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | 21 | - name: Set up JDK ${{ matrix.java }} 22 | uses: actions/setup-java@v4 23 | with: 24 | distribution: 'zulu' 25 | java-version: ${{ matrix.java }} 26 | cache: 'maven' 27 | 28 | - name: Prepare mvnw 29 | run: chmod +x ./mvnw 30 | 31 | - name: Build 32 | run: ./mvnw clean package 33 | 34 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/Java9SupportCheck.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | /** 4 | * Utility class to check if java 9 api is unsupported. 5 | */ 6 | final class Java9SupportCheck { 7 | 8 | /** 9 | * Constant to check if JAVA 9 API is unsupported. 10 | */ 11 | final static boolean UNSUPPORTED_JAVA_VERSION; 12 | 13 | static { 14 | 15 | // get ModuleFinderClass 16 | Class moduleFinderClass = null; 17 | try { 18 | moduleFinderClass = Class.forName("java.lang.module.ModuleFinder"); 19 | } catch (Exception e) { 20 | // ignore 21 | } 22 | 23 | UNSUPPORTED_JAVA_VERSION = moduleFinderClass == null; 24 | 25 | } 26 | 27 | /** 28 | * Hidden constructor. 29 | */ 30 | private Java9SupportCheck() { 31 | 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /integration-test/java9/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | integration-test-java9-parent 6 | pom 7 | 8 | 9 | io.toolisticon.cute 10 | integration-test-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | integration-test-java9-parent 15 | 16 | 17 | regularTestModule 18 | namedAutomaticModule 19 | unnamedAutomaticModule 20 | test 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /integration-test/java9/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-java9-parent 5 | pom 6 | 7 | 8 | io.toolisticon.compiletesting 9 | integration-test-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-java9-parent 14 | 15 | 16 | regularTestModule 17 | namedAutomaticModule 18 | unnamedAutomaticModule 19 | test 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/CommonUtilities.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | * Some common utility functions. 7 | */ 8 | final class CommonUtilities { 9 | 10 | /** 11 | * Hidden constructor. 12 | */ 13 | private CommonUtilities() { 14 | 15 | } 16 | 17 | public static String getRandomString(int length) { 18 | 19 | int leftLimit = 97; // letter 'a' 20 | int rightLimit = 122; // letter 'z' 21 | Random random = new Random(); 22 | StringBuilder buffer = new StringBuilder(length); 23 | for (int i = 0; i < length; i++) { 24 | int randomLimitedInt = leftLimit + (int) 25 | (random.nextFloat() * (rightLimit - leftLimit + 1)); 26 | buffer.append((char) randomLimitedInt); 27 | } 28 | return buffer.toString(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/testcases/TestAnnotationProcessorWithMissingNoArgConstructor.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.testcases; 2 | 3 | 4 | import javax.annotation.processing.AbstractProcessor; 5 | import javax.annotation.processing.RoundEnvironment; 6 | import javax.annotation.processing.SupportedAnnotationTypes; 7 | import javax.lang.model.element.TypeElement; 8 | import java.util.Set; 9 | 10 | /** 11 | * Test annotation processor. Does nothing. 12 | */ 13 | 14 | @SupportedAnnotationTypes("io.toolisticon.cute.TestAnnotation") 15 | public class TestAnnotationProcessorWithMissingNoArgConstructor extends AbstractProcessor { 16 | 17 | public TestAnnotationProcessorWithMissingNoArgConstructor(String x) { 18 | 19 | } 20 | 21 | @Override 22 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /extension/api/src/main/java/io/toolisticon/cute/extension/api/AssertionSpi.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.api; 2 | 3 | import java.util.Set; 4 | 5 | import io.toolisticon.spiap.api.Spi; 6 | 7 | /** 8 | * Spi to set a failing assertion during compile testing. 9 | */ 10 | @Spi 11 | public interface AssertionSpi { 12 | 13 | /** 14 | * Triggers a failing assertion. 15 | * 16 | * @param message the failing assertion message 17 | */ 18 | void fail(String message); 19 | 20 | /** 21 | * Triggers a failing assertion. 22 | * 23 | * @param message the failing assertion message 24 | */ 25 | void fail(String message, Throwable cause); 26 | 27 | /** 28 | * Get the differt assertion error types used by the framework. 29 | * @return 30 | */ 31 | Set> getSupportedAssertionTypes(); 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /legacy/src/test/java/io/toolisticon/cute/common/SimpleTestProcessor1.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.ProcessingEnvironment; 5 | import javax.annotation.processing.RoundEnvironment; 6 | import javax.lang.model.element.TypeElement; 7 | import java.util.Arrays; 8 | import java.util.HashSet; 9 | import java.util.Set; 10 | 11 | 12 | public class SimpleTestProcessor1 extends AbstractProcessor { 13 | @Override 14 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 15 | return false; 16 | } 17 | 18 | 19 | @Override 20 | public Set getSupportedAnnotationTypes() { 21 | 22 | return new HashSet(Arrays.asList(SimpleTestAnnotation1.class.getCanonicalName())); 23 | 24 | } 25 | 26 | public ProcessingEnvironment getProcessingEnvironment() { 27 | return this.processingEnv; 28 | } 29 | } -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/matchers/RegexGeneratedFileObjectMatcherTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.FailingAssertionException; 4 | import io.toolisticon.cute.JavaFileObjectUtils; 5 | import org.junit.Test; 6 | 7 | import java.io.IOException; 8 | 9 | 10 | /** 11 | * Unit test for {@link RegexGeneratedFileObjectMatcher}. 12 | */ 13 | public class RegexGeneratedFileObjectMatcherTest { 14 | 15 | @Test 16 | public void testForRegexMatcher_valid() throws IOException { 17 | 18 | CoreGeneratedFileObjectMatchers.createRegexMatcher(".*head.*").check(JavaFileObjectUtils.readFromString("war\nheadwarbody")); 19 | 20 | } 21 | 22 | @Test(expected = FailingAssertionException.class) 23 | public void testForRegexMatcher_invalid() throws IOException { 24 | 25 | CoreGeneratedFileObjectMatchers.createRegexMatcher(".*abc.*").check(JavaFileObjectUtils.readFromString("\n\n\nbody>\n\n")); 26 | 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestForTestingAnnotationProcessorsWithoutPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.ProcessingEnvironment; 4 | import javax.annotation.processing.Processor; 5 | 6 | /** 7 | * Interface that is used during unit test creation. It allows setting up a unit test without the need to create a valid annotation processor. 8 | * In comparison to {@link UnitTest} an instance of the processor under test will be created and it's init method will be called. 9 | * 10 | * @param the processor to use 11 | */ 12 | public interface UnitTestForTestingAnnotationProcessorsWithoutPassIn extends UnitTestBase { 13 | 14 | /** 15 | * The unit test method. 16 | * 17 | * @param unit the initialized processor under test (initialized via init method) 18 | * @param processingEnvironment the processingEnvironment 19 | */ 20 | void unitTest(PROCESSOR unit, ProcessingEnvironment processingEnvironment); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /extension/testng/src/main/java/io/toolisticon/cute/extension/testng/TestNGAssertion.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.testng; 2 | 3 | import io.toolisticon.cute.extension.api.AssertionSpi; 4 | import io.toolisticon.spiap.api.Service; 5 | 6 | import java.util.HashSet; 7 | import java.util.Set; 8 | 9 | import org.testng.Assert; 10 | 11 | 12 | @Service(value = AssertionSpi.class, priority = -10, description = "TestNG assertion framework") 13 | public class TestNGAssertion implements AssertionSpi { 14 | 15 | private final static Set> ASSERTION_TYPES = new HashSet<>(); 16 | static { 17 | ASSERTION_TYPES.add(AssertionError.class); 18 | } 19 | 20 | @Override 21 | public void fail(String message) { 22 | Assert.fail(message); 23 | } 24 | 25 | @Override 26 | public void fail(String message, Throwable cause) { 27 | Assert.fail(message, cause); 28 | } 29 | 30 | @Override 31 | public Set> getSupportedAssertionTypes() { 32 | return ASSERTION_TYPES; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/TestUtilities.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import org.hamcrest.MatcherAssert; 4 | 5 | public final class TestUtilities { 6 | 7 | private TestUtilities() { 8 | 9 | } 10 | 11 | public static void assertAssertionMessageContainsMessageTokensAssertion(AssertionError assertionError, String message) { 12 | 13 | MatcherAssert.assertThat("AssertionError message '" + assertionError.getMessage() + "' should have matched message string: '" + message + "'", assertAssertionMessageContainsMessageTokens(assertionError, message)); 14 | 15 | } 16 | 17 | public static boolean assertAssertionMessageContainsMessageTokens(AssertionError assertionError, String message) { 18 | 19 | String[] messageTokens = message.split("[%]s"); 20 | 21 | for (String messageToken : messageTokens) { 22 | 23 | if (!assertionError.getMessage().contains(messageToken)) { 24 | return false; 25 | } 26 | 27 | } 28 | 29 | return true; 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/matchers/WellFormedXmlGerneratedFileObjectMatcherTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.FailingAssertionException; 4 | import io.toolisticon.cute.JavaFileObjectUtils; 5 | import org.junit.Test; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * Unit test for {@link WellFormedXmlGeneratedFileObjectMatcher}. 11 | */ 12 | public class WellFormedXmlGerneratedFileObjectMatcherTest { 13 | 14 | @Test 15 | public void testForWellFormedXml_validXml() throws IOException { 16 | 17 | CoreGeneratedFileObjectMatchers.createIsWellFormedXmlMatcher().check(JavaFileObjectUtils.readFromString("\n\n\n\n\n")); 18 | 19 | } 20 | 21 | @Test(expected = FailingAssertionException.class) 22 | public void testForWellFormedXml_invalidXml() throws IOException { 23 | 24 | CoreGeneratedFileObjectMatchers.createIsWellFormedXmlMatcher().check(JavaFileObjectUtils.readFromString("\n\n\nbody>\n\n")); 25 | 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /extension/junit5/src/main/java/io/toolisticon/cute/extension/junit5/JUnit5Assertion.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.junit5; 2 | 3 | import io.toolisticon.cute.extension.api.AssertionSpi; 4 | import io.toolisticon.spiap.api.Service; 5 | 6 | import java.util.HashSet; 7 | import java.util.Set; 8 | 9 | import org.junit.jupiter.api.Assertions; 10 | 11 | 12 | @Service(value = AssertionSpi.class, priority = -10, description = "junit 5 assertion framework") 13 | public class JUnit5Assertion implements AssertionSpi { 14 | 15 | private final static Set> ASSERTION_TYPES = new HashSet<>(); 16 | static { 17 | ASSERTION_TYPES.add(AssertionError.class); 18 | } 19 | 20 | @Override 21 | public void fail(String message) { 22 | Assertions.fail(message); 23 | } 24 | 25 | @Override 26 | public void fail(String message, Throwable cause) { 27 | Assertions.fail(message, cause); 28 | } 29 | 30 | @Override 31 | public Set> getSupportedAssertionTypes() { 32 | return ASSERTION_TYPES; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /.github/workflows/jacoco.yml: -------------------------------------------------------------------------------- 1 | name: jacoco 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | - '**/*' 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout code 16 | uses: actions/checkout@v4 17 | 18 | - name: Set up JDK 9 19 | uses: actions/setup-java@v4 20 | with: 21 | distribution: 'zulu' 22 | java-version: 9 23 | 24 | - name: Cache .m2 25 | uses: actions/cache@v4 26 | with: 27 | path: ~/.m2/repository 28 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 29 | restore-keys: | 30 | ${{ runner.os }}-maven 31 | 32 | - name: Prepare mvnw 33 | run: chmod +x ./mvnw 34 | 35 | - name: Build 36 | run: ./mvnw verify jacoco:report-aggregate -B -q 37 | 38 | - name: Upload coverage to Codecov 39 | uses: codecov/codecov-action@v3.1.5 40 | with: 41 | token: ${{secrets.CODECOV_TOKEN}} 42 | file: target/site/jacoco-aggregate/jacoco.xml 43 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.ProcessingEnvironment; 4 | import javax.lang.model.element.Element; 5 | 6 | /** 7 | * Interface that is used during unit test creation. It allows setting up a unit test without the need to create a valid annotation processor. 8 | *

9 | * It allows passing in of an element. 10 | * This is either the processed element or a passed in element depending on unit test setup. 11 | *

12 | * Please use {@link UnitTestForTestingAnnotationProcessors} if you want to unit test annotation processor methods. 13 | */ 14 | public interface UnitTest extends UnitTestBase { 15 | 16 | /** 17 | * The unit test method. 18 | * 19 | * @param processingEnvironment the processingEnvironment 20 | * @param element the passed in element: either the processed element or the passed in element depending on unit test setup 21 | */ 22 | void unitTest(ProcessingEnvironment processingEnvironment, ELEMENT_TYPE element); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /extension/plainjava/src/main/java/io/toolisticon/cute/extension/plainjava/AssertionErrorAssertion.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.plainjava; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | import io.toolisticon.cute.extension.api.AssertionSpi; 7 | import io.toolisticon.spiap.api.Service; 8 | 9 | @Service(value = AssertionSpi.class, priority = 0, description = "Java's AssertionError should work with all testing frameworks") 10 | public class AssertionErrorAssertion implements AssertionSpi { 11 | 12 | private final static Set> ASSERTION_TYPES = new HashSet<>(); 13 | static { 14 | ASSERTION_TYPES.add(AssertionError.class); 15 | } 16 | 17 | @Override 18 | public void fail(String message) { 19 | throw new AssertionError(message); 20 | } 21 | 22 | @Override 23 | public void fail(String message, Throwable cause) { 24 | throw new AssertionError(message, cause); 25 | } 26 | 27 | 28 | @Override 29 | public Set> getSupportedAssertionTypes() { 30 | return ASSERTION_TYPES; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 TOOListicon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /extension/plainjava/src/test/java/io/toolisticon/cute/extension/plainjava/AssertionErrorAssertionTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.plainjava; 2 | 3 | import io.toolisticon.cute.extension.api.AssertionSpi; 4 | import io.toolisticon.cute.extension.api.AssertionSpiServiceLocator; 5 | 6 | import org.hamcrest.MatcherAssert; 7 | import org.hamcrest.Matchers; 8 | import org.junit.Assert; 9 | import org.junit.Test; 10 | 11 | public class AssertionErrorAssertionTest { 12 | 13 | @Test 14 | public void testServiceLocator() { 15 | 16 | MatcherAssert.assertThat(AssertionSpiServiceLocator.locate().getClass(), Matchers.is((Class)AssertionErrorAssertion.class)); 17 | 18 | } 19 | 20 | @Test 21 | public void testTriggeringAssertionError() { 22 | 23 | AssertionSpi service = AssertionSpiServiceLocator.locate(); 24 | 25 | try { 26 | service.fail("TEST"); 27 | } catch (AssertionError e) { 28 | MatcherAssert.assertThat(e.getMessage(), Matchers.is("TEST")); 29 | return; 30 | } 31 | Assert.fail("Expected triggered AsserionError"); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /extension/junit4/src/main/java/io/toolisticon/cute/extension/junit4/JUnit4Assertion.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.junit4; 2 | 3 | import java.lang.AssertionError; 4 | 5 | import io.toolisticon.cute.extension.api.AssertionSpi; 6 | import io.toolisticon.spiap.api.Service; 7 | 8 | import java.util.Collections; 9 | import java.util.HashSet; 10 | import java.util.Set; 11 | 12 | import org.junit.Assert; 13 | 14 | @Service(value = AssertionSpi.class, priority = -5, description = "junit 4 assertion framework") 15 | public class JUnit4Assertion implements AssertionSpi { 16 | 17 | private final static Set> ASSERTION_TYPES = new HashSet<>(); 18 | static { 19 | ASSERTION_TYPES.add(AssertionError.class); 20 | } 21 | 22 | @Override 23 | public void fail(String message) { 24 | Assert.fail(message); 25 | } 26 | 27 | 28 | 29 | @Override 30 | public void fail(String message, Throwable cause) { 31 | throw new AssertionError(message, cause); 32 | } 33 | 34 | 35 | 36 | @Override 37 | public Set> getSupportedAssertionTypes() { 38 | return ASSERTION_TYPES; 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /extension/junit4/src/test/java/io/toolisticon/cute/extension/junit4/JUnit4AssertionTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.junit4; 2 | 3 | import org.hamcrest.MatcherAssert; 4 | import org.hamcrest.Matchers; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | import io.toolisticon.cute.extension.api.AssertionSpi; 9 | import io.toolisticon.cute.extension.api.AssertionSpiServiceLocator; 10 | 11 | /** 12 | * Unit test for {@link JUnit4Assertion}. 13 | */ 14 | public class JUnit4AssertionTest { 15 | 16 | @Test 17 | public void testServiceLocator() { 18 | 19 | MatcherAssert.assertThat(AssertionSpiServiceLocator.locate().getClass(), Matchers.is((Class) JUnit4Assertion.class)); 20 | 21 | } 22 | 23 | @Test 24 | public void testTriggeringAssertionError() { 25 | 26 | AssertionSpi service = AssertionSpiServiceLocator.locate(); 27 | 28 | try { 29 | service.fail("TEST"); 30 | } catch (AssertionError e) { 31 | MatcherAssert.assertThat(e.getMessage(), Matchers.is("TEST")); 32 | return; 33 | } 34 | Assert.fail("Expected triggered AsserionError"); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/ExceptionThrowerProcessor.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.ProcessingEnvironment; 5 | import javax.annotation.processing.RoundEnvironment; 6 | import javax.lang.model.element.Element; 7 | import javax.lang.model.element.TypeElement; 8 | import javax.tools.JavaFileObject; 9 | import java.io.BufferedWriter; 10 | import java.io.IOException; 11 | import java.util.Arrays; 12 | import java.util.HashSet; 13 | import java.util.Set; 14 | 15 | public class ExceptionThrowerProcessor extends AbstractProcessor { 16 | @Override 17 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 18 | 19 | throw new IllegalStateException("WHOOPS!!!"); 20 | 21 | } 22 | 23 | 24 | @Override 25 | public Set getSupportedAnnotationTypes() { 26 | 27 | return new HashSet(Arrays.asList(ExceptionThrowerAnnotation.class.getCanonicalName())); 28 | 29 | } 30 | 31 | public ProcessingEnvironment getProcessingEnvironment() { 32 | return this.processingEnv; 33 | } 34 | } -------------------------------------------------------------------------------- /extension/testng/src/test/java/io/toolisticon/cute/extension/testng/TestNGAssertionTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.testng; 2 | 3 | import io.toolisticon.cute.extension.api.AssertionSpi; 4 | import io.toolisticon.cute.extension.api.AssertionSpiServiceLocator; 5 | 6 | import org.hamcrest.MatcherAssert; 7 | import org.hamcrest.Matchers; 8 | import org.testng.Assert; 9 | import org.testng.annotations.Test; 10 | 11 | /** 12 | * Unit test for {@link TestNGAssertion}. 13 | */ 14 | public class TestNGAssertionTest { 15 | 16 | @Test 17 | public void testServiceLocator() { 18 | 19 | MatcherAssert.assertThat(AssertionSpiServiceLocator.locate().getClass(), Matchers.is((Class)TestNGAssertion.class)); 20 | 21 | } 22 | 23 | @Test 24 | public void testTriggeringAssertionError() { 25 | 26 | AssertionSpi service = AssertionSpiServiceLocator.locate(); 27 | 28 | try { 29 | service.fail("TEST"); 30 | } catch (AssertionError e) { 31 | MatcherAssert.assertThat(e.getMessage(), Matchers.is("TEST")); 32 | return; 33 | } 34 | Assert.fail("Expected triggered AsserionError"); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /extension/junit5/src/test/java/io/toolisticon/cute/extension/junit5/JUnit5AssertionTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.extension.junit5; 2 | 3 | import io.toolisticon.cute.extension.api.AssertionSpi; 4 | import io.toolisticon.cute.extension.api.AssertionSpiServiceLocator; 5 | 6 | import org.hamcrest.MatcherAssert; 7 | import org.hamcrest.Matchers; 8 | import org.junit.jupiter.api.Assertions; 9 | import org.junit.jupiter.api.Test; 10 | 11 | /** 12 | * Unit test for {@link JUnit5Assertion}. 13 | */ 14 | public class JUnit5AssertionTest { 15 | 16 | @Test 17 | public void testServiceLocator() { 18 | 19 | MatcherAssert.assertThat(AssertionSpiServiceLocator.locate().getClass(), Matchers.is((Class) JUnit5Assertion.class)); 20 | 21 | } 22 | 23 | @Test 24 | public void testTriggeringAssertionError() { 25 | 26 | AssertionSpi service = AssertionSpiServiceLocator.locate(); 27 | 28 | try { 29 | service.fail("TEST"); 30 | } catch (AssertionError e) { 31 | MatcherAssert.assertThat(e.getMessage(), Matchers.is("TEST")); 32 | return; 33 | } 34 | Assertions.fail("Expected triggered AsserionError"); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/FileObjectUtilsTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import org.hamcrest.MatcherAssert; 4 | import org.hamcrest.Matchers; 5 | import org.junit.Test; 6 | 7 | import javax.tools.FileObject; 8 | import java.io.BufferedReader; 9 | import java.io.IOException; 10 | 11 | /** 12 | * Unit test for {@link FileObjectUtils}. 13 | */ 14 | public class FileObjectUtilsTest { 15 | 16 | @Test 17 | public void test_fromString() throws IOException { 18 | 19 | FileObject fileObject = FileObjectUtils.fromString("TEST"); 20 | MatcherAssert.assertThat(fileObject.getCharContent(false), Matchers.is("TEST")); 21 | MatcherAssert.assertThat(new BufferedReader(fileObject.openReader(true)).readLine(), Matchers.is("TEST")); 22 | 23 | 24 | 25 | } 26 | 27 | @Test 28 | public void test_fromResource() throws IOException { 29 | 30 | FileObject fileObject = FileObjectUtils.fromResource("/compiletests/tata.txt"); 31 | MatcherAssert.assertThat(fileObject.getCharContent(false), Matchers.is("TATA!")); 32 | MatcherAssert.assertThat(new BufferedReader(fileObject.openReader(true)).readLine(), Matchers.is("TATA!")); 33 | 34 | 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestForTestingAnnotationProcessors.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.ProcessingEnvironment; 4 | import javax.annotation.processing.Processor; 5 | import javax.lang.model.element.Element; 6 | 7 | /** 8 | * Interface that is used during unit test creation. It allows setting up a unit test without the need to create a valid annotation processor. 9 | * In comparison to {@link UnitTest} an instance of the processor under test will be created and it's init method will be called. 10 | * 11 | * @param the processor to use 12 | * @param the expected element type to be found 13 | */ 14 | public interface UnitTestForTestingAnnotationProcessors extends UnitTestBase { 15 | 16 | /** 17 | * The unit test method. 18 | * 19 | * @param unit the initialized processor under test (initialized via init method) 20 | * @param processingEnvironment the processingEnvironment 21 | * @param element the element the underlying annotation processor is applied on 22 | */ 23 | void unitTest(PROCESSOR unit, ProcessingEnvironment processingEnvironment, ELEMENT_TYPE element); 24 | } 25 | -------------------------------------------------------------------------------- /integration-test/junit4/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | integration-test-junit4 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | integration-test-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | integration-test-junit4 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | cute 22 | 23 | 24 | 25 | io.toolisticon.cute 26 | extension-junit4 27 | ${project.version} 28 | 29 | 30 | 31 | junit 32 | junit 33 | test 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/matchers/ContainsStringsGeneratedFileObjectMatcher.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.Constants; 4 | import io.toolisticon.cute.FailingAssertionException; 5 | import io.toolisticon.cute.GeneratedFileObjectMatcher; 6 | 7 | import javax.tools.FileObject; 8 | import java.io.IOException; 9 | 10 | /** 11 | * Validates if the generated file contains all passed Strings. 12 | */ 13 | class ContainsStringsGeneratedFileObjectMatcher implements GeneratedFileObjectMatcher { 14 | 15 | 16 | String[] stringsToCheck; 17 | 18 | /** 19 | * Hidden constructor 20 | */ 21 | ContainsStringsGeneratedFileObjectMatcher(String... stringsToCheck) { 22 | this.stringsToCheck = stringsToCheck; 23 | } 24 | 25 | @Override 26 | public boolean check(FileObject fileObject) throws IOException { 27 | 28 | String fileContent = fileObject.getCharContent(true).toString(); 29 | 30 | for (String stringToCheck : stringsToCheck) { 31 | 32 | if (!fileContent.contains(stringToCheck)) { 33 | throw new FailingAssertionException(Constants.Messages.GFOM_COULDNT_FIND_SUBSTRING.produceMessage(stringToCheck, fileObject.getName())); 34 | } 35 | 36 | } 37 | 38 | return true; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /integration-test/junit4/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-junit4 5 | bundle 6 | 7 | 8 | io.toolisticon.compiletesting 9 | integration-test-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-junit4 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.compiletesting 20 | compiletesting 21 | 22 | 23 | 24 | io.toolisticon.compiletesting 25 | extension-junit4 26 | ${project.version} 27 | 28 | 29 | 30 | junit 31 | junit 32 | test 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /integration-test/testng/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-testng 5 | jar 6 | 7 | 8 | io.toolisticon.cute 9 | integration-test-parent 10 | 1.9.1-SNAPSHOT 11 | 12 | 13 | integration-test-testng 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.cute 20 | cute 21 | 22 | 23 | 24 | io.toolisticon.cute 25 | extension-testng 26 | ${project.version} 27 | 28 | 29 | 30 | org.testng 31 | testng 32 | ${testng.version} 33 | test 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/matchers/BinaryGeneratedFileObjectMatcherTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.FailingAssertionException; 4 | import io.toolisticon.cute.JavaFileObjectUtils; 5 | import org.hamcrest.MatcherAssert; 6 | import org.junit.Test; 7 | 8 | import javax.tools.FileObject; 9 | import java.io.IOException; 10 | 11 | /** 12 | * Unit test for {@link BinaryGeneratedFileObjectMatcher}. 13 | */ 14 | public class BinaryGeneratedFileObjectMatcherTest { 15 | 16 | 17 | @Test 18 | public void check_matchingFiles() throws IOException { 19 | 20 | FileObject fo1 = JavaFileObjectUtils.readFromString("ABCDEF"); 21 | FileObject fo2 = JavaFileObjectUtils.readFromString("ABCDEF"); 22 | 23 | BinaryGeneratedFileObjectMatcher unit = new BinaryGeneratedFileObjectMatcher(fo1); 24 | MatcherAssert.assertThat("Must match", unit.check(fo2)); 25 | 26 | 27 | } 28 | 29 | @Test(expected = FailingAssertionException.class) 30 | public void check_nonMatchingFiles() throws IOException { 31 | 32 | FileObject fo1 = JavaFileObjectUtils.readFromString("ABCDEF"); 33 | FileObject fo2 = JavaFileObjectUtils.readFromString("ABCXXXEF"); 34 | 35 | BinaryGeneratedFileObjectMatcher unit = new BinaryGeneratedFileObjectMatcher(fo1); 36 | unit.check(fo2); 37 | 38 | 39 | } 40 | 41 | 42 | } -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/matchers/IgnoreLineEndingsGeneratedFileObjectMatcherTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.FailingAssertionException; 4 | import io.toolisticon.cute.JavaFileObjectUtils; 5 | import org.hamcrest.MatcherAssert; 6 | import org.junit.Test; 7 | 8 | import javax.tools.FileObject; 9 | import java.io.IOException; 10 | 11 | public class IgnoreLineEndingsGeneratedFileObjectMatcherTest { 12 | 13 | @Test 14 | public void check_matchingFiles() throws IOException { 15 | 16 | FileObject fo1 = JavaFileObjectUtils.readFromString("ABC\nDEF\r\nHIJ\nKLM\r\nNOP"); 17 | FileObject fo2 = JavaFileObjectUtils.readFromString("ABC\r\nDEF\nHIJ\nKLM\r\nNOP"); 18 | 19 | IgnoreLineEndingsGeneratedFileObjectMatcher unit = new IgnoreLineEndingsGeneratedFileObjectMatcher(fo1); 20 | MatcherAssert.assertThat("Must match", unit.check(fo2)); 21 | 22 | 23 | } 24 | 25 | @Test(expected = FailingAssertionException.class) 26 | public void check_nonMatchingFiles() throws IOException { 27 | 28 | FileObject fo1 = JavaFileObjectUtils.readFromString("ABCDEF"); 29 | FileObject fo2 = JavaFileObjectUtils.readFromString("ABCXXXEF"); 30 | 31 | IgnoreLineEndingsGeneratedFileObjectMatcher unit = new IgnoreLineEndingsGeneratedFileObjectMatcher(fo1); 32 | unit.check(fo2); 33 | 34 | 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /integration-test/junit5/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | integration-test-junit5 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | integration-test-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | integration-test-junit5 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | cute 22 | 23 | 24 | 25 | io.toolisticon.cute 26 | extension-junit5 27 | ${project.version} 28 | 29 | 30 | 31 | org.junit.jupiter 32 | junit-jupiter-api 33 | ${junit5.version} 34 | test 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /integration-test/testng/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-testng 5 | bundle 6 | 7 | 8 | io.toolisticon.compiletesting 9 | integration-test-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-testng 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.compiletesting 20 | compiletesting 21 | 22 | 23 | 24 | io.toolisticon.compiletesting 25 | extension-testng 26 | ${project.version} 27 | 28 | 29 | 30 | org.testng 31 | testng 32 | ${testng.version} 33 | test 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /integration-test/junit5/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-junit5 5 | bundle 6 | 7 | 8 | io.toolisticon.compiletesting 9 | integration-test-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-junit5 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.compiletesting 20 | compiletesting 21 | 22 | 23 | 24 | io.toolisticon.compiletesting 25 | extension-testng 26 | ${project.version} 27 | 28 | 29 | 30 | org.junit.jupiter 31 | junit-jupiter-api 32 | ${junit5.version} 33 | test 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/matchers/ContainsStringsGeneratedFileObjectMatcherTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.FailingAssertionException; 4 | import io.toolisticon.cute.JavaFileObjectUtils; 5 | import org.junit.Test; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * Unit test for {@link ContainsStringsGeneratedFileObjectMatcher}. 11 | */ 12 | public class ContainsStringsGeneratedFileObjectMatcherTest { 13 | 14 | @Test 15 | public void testForContainingStrings_valid() throws IOException { 16 | 17 | CoreGeneratedFileObjectMatchers.createContainsSubstringsMatcher("head", "body").check(JavaFileObjectUtils.readFromString("\n\n\n\n\n")); 18 | 19 | } 20 | 21 | @Test(expected = FailingAssertionException.class) 22 | public void testForContainingStrings_invalid() throws IOException { 23 | 24 | CoreGeneratedFileObjectMatchers.createContainsSubstringsMatcher("head", "whoopdidoo").check(JavaFileObjectUtils.readFromString("\n\n\n\n\n")); 25 | 26 | } 27 | 28 | /*- 29 | @Test 30 | public void checkUsageOnFileObject() { 31 | 32 | CuteFluentApiStarter.blackBoxTest()..compilationTest().expectThatJavaFileObjectExists(StandardLocation.SOURCE_OUTPUT,"io.toolisticon.cute.TestClass", JavaFileObject.Kind.SOURCE,CoreGeneratedFileObjectMatchers.createContainsSubstringsMatcher("abc")); 33 | 34 | } 35 | 36 | */ 37 | 38 | 39 | } -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/matchers/RegexGeneratedFileObjectMatcher.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.Constants; 4 | import io.toolisticon.cute.FailingAssertionException; 5 | import io.toolisticon.cute.GeneratedFileObjectMatcher; 6 | 7 | import javax.tools.FileObject; 8 | import java.io.IOException; 9 | import java.util.regex.Pattern; 10 | import java.util.regex.PatternSyntaxException; 11 | 12 | /** 13 | * Validates a generated file by using a regular expression. 14 | */ 15 | class RegexGeneratedFileObjectMatcher implements GeneratedFileObjectMatcher { 16 | 17 | final String patternString; 18 | private final Pattern pattern; 19 | 20 | /** 21 | * Hidden constructor. 22 | * 23 | * @param patternString a valid pattern string 24 | * @throws PatternSyntaxException If the expression's syntax is invalid 25 | */ 26 | RegexGeneratedFileObjectMatcher(String patternString) { 27 | 28 | this.patternString = patternString; 29 | this.pattern = Pattern.compile(patternString, Pattern.MULTILINE | Pattern.UNIX_LINES | Pattern.DOTALL); 30 | } 31 | 32 | @Override 33 | public boolean check(FileObject fileObject) throws IOException { 34 | 35 | String content = fileObject.getCharContent(true).toString(); 36 | 37 | if (!pattern.matcher(content).matches()) { 38 | throw new FailingAssertionException(Constants.Messages.GFOM_FILEOBJECT_DOESNT_MATCH_PATTERN.produceMessage(content, patternString)); 39 | } 40 | 41 | return true; 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/matchers/WellFormedXmlGeneratedFileObjectMatcher.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | 4 | import io.toolisticon.cute.Constants; 5 | import io.toolisticon.cute.FailingAssertionException; 6 | import io.toolisticon.cute.GeneratedFileObjectMatcher; 7 | 8 | import javax.tools.FileObject; 9 | import javax.xml.parsers.DocumentBuilder; 10 | import javax.xml.parsers.DocumentBuilderFactory; 11 | import java.io.IOException; 12 | 13 | /** 14 | * Matcher to check if file contains well-formed xml. 15 | */ 16 | class WellFormedXmlGeneratedFileObjectMatcher implements GeneratedFileObjectMatcher { 17 | 18 | /** 19 | * Hidden constructor 20 | */ 21 | WellFormedXmlGeneratedFileObjectMatcher() { 22 | 23 | } 24 | 25 | @Override 26 | public boolean check(FileObject fileObject) throws IOException { 27 | 28 | try { 29 | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 30 | 31 | // speed up processing by preventing downloading of dtds 32 | factory.setValidating(false); 33 | factory.setNamespaceAware(false); 34 | factory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); 35 | factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); 36 | 37 | DocumentBuilder builder = factory.newDocumentBuilder(); 38 | builder.parse(fileObject.openInputStream()); 39 | 40 | return true; 41 | } catch (Exception e) { 42 | throw new FailingAssertionException(Constants.Messages.GFOM_FILEOBJECT_IS_NOT_WELL_FORMED.produceMessage(fileObject.getName())); 43 | } 44 | 45 | 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release_on_master 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | jobs: 8 | build: 9 | 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout Code 14 | uses: actions/checkout@v4 15 | 16 | - name: Cache .m2 17 | uses: actions/cache@v4 18 | with: 19 | path: ~/.m2/repository 20 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 21 | restore-keys: | 22 | ${{ runner.os }}-maven 23 | 24 | # Get GPG private key into GPG 25 | - name: Import GPG Owner Trust 26 | run: echo ${{ secrets.GPG_OWNERTRUST }} | base64 --decode | gpg --import-ownertrust 27 | - name: Import GPG key 28 | run: echo ${{ secrets.GPG_SECRET_KEYS }} | base64 --decode | gpg --import --no-tty --batch --yes 29 | 30 | # Setup JDK and Maven 31 | - name: Set up JDK 9 32 | uses: actions/setup-java@v4 33 | with: 34 | distribution: 'zulu' 35 | java-version: 9 36 | server-id: central 37 | server-username: OSS_CENTRAL_USERNAME # env variable for Maven Central 38 | server-password: OSS_CENTRAL_PASSWORD # env variable for Maven Central 39 | 40 | - name: Prepare mvnw 41 | run: chmod +x ./mvnw 42 | 43 | - name: Build 44 | run: ./mvnw clean package 45 | 46 | - name: Deploy a new version to central 47 | run: ./mvnw javadoc:jar source:jar deploy -B -DskipTests -Prelease -Dgpg.keyname=${{secrets.GPG_KEYNAME}} -Dgpg.passphrase="${{secrets.GPG_PASSPHRASE}}" 48 | env: 49 | OSS_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }} 50 | OSS_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} 51 | -------------------------------------------------------------------------------- /integration-test/java9/unnamedAutomaticModule/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | integration-test-java9-unnamedAutomaticModule 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | integration-test-java9-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | integration-test-java9-unnamedAutomaticModule 15 | 16 | 17 | 18 | 19 | io.toolisticon.cute 20 | cute 21 | 22 | 23 | 24 | junit 25 | junit 26 | test 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.apache.maven.plugins 37 | maven-jar-plugin 38 | 3.2.0 39 | 40 | 41 | 42 | integration.test.javanine.unnamedautomaticmodule 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /integration-test/java9/namedAutomaticModule/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | integration-test-java9-namedAutomaticModule 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | integration-test-java9-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | integration-test-java9-namedAutomaticModule 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | cute 22 | 23 | 24 | 25 | junit 26 | junit 27 | test 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | org.apache.maven.plugins 39 | maven-jar-plugin 40 | 3.2.0 41 | 42 | 43 | 44 | integration.test.javanine.namedautomaticmodule 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestAnnotationProcessorClassWithPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.RoundEnvironment; 4 | import javax.lang.model.element.Element; 5 | import javax.lang.model.element.TypeElement; 6 | import java.lang.annotation.Annotation; 7 | import java.util.Set; 8 | 9 | class UnitTestAnnotationProcessorClassWithPassIn extends AbstractUnitTestAnnotationProcessorWithPassIn { 10 | 11 | 12 | /** 13 | * The unit test processor instance to use. 14 | */ 15 | private final UnitTest unitTest; 16 | 17 | 18 | public UnitTestAnnotationProcessorClassWithPassIn(Class classToScan, Class annotationTypeUsedForScan, UnitTest unitTest) { 19 | super(TestAnnotation.class, classToScan, annotationTypeUsedForScan); 20 | this.unitTest = unitTest; 21 | } 22 | 23 | 24 | @Override 25 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 26 | 27 | // just try to execute tests if annotation is processed == annotations size is 1 28 | if (!roundEnv.processingOver() && annotations.size() == 1) { 29 | 30 | try { 31 | unitTest.unitTest(this.processingEnv, (ELEMENT_TYPE) getPassedInElement()); 32 | } catch (ClassCastException e) { 33 | if (e.getMessage() != null && e.getMessage().contains("com.sun.tools.javac.code.Symbol$ClassSymbol")) { 34 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_INCOMPATIBLE_ELEMENT_TYPE.produceMessage()); 35 | } else { 36 | throw e; 37 | } 38 | } 39 | 40 | } 41 | return false; 42 | } 43 | 44 | 45 | } -------------------------------------------------------------------------------- /integration-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-parent 5 | pom 6 | 7 | 8 | io.toolisticon.cute 9 | cute-parent 10 | 1.9.1-SNAPSHOT 11 | 12 | 13 | integration-test-parent 14 | 15 | 16 | junit4 17 | testng 18 | 19 | 20 | 21 | 22 | 23 | 24 | java-8 25 | 26 | [1.8,) 27 | 28 | 29 | 30 | junit5 31 | 32 | 33 | 34 | 35 | 36 | java-9 37 | 38 | [1.9,) 39 | 40 | 41 | 42 | java9 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | org.apache.maven.plugins 54 | maven-deploy-plugin 55 | 56 | true 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /integration-test/java9/namedAutomaticModule/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-java9-namedAutomaticModule 5 | bundle 6 | 7 | 8 | io.toolisticon.compiletesting 9 | integration-test-java9-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-java9-namedAutomaticModule 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.compiletesting 20 | compiletesting 21 | 22 | 23 | 24 | junit 25 | junit 26 | test 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.apache.maven.plugins 38 | maven-jar-plugin 39 | 3.1.1 40 | 41 | 42 | 43 | integration.test.java9.namedautomaticmodule 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /integration-test/java9/unnamedAutomaticModule/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-java9-unnamedAutomaticModule 5 | bundle 6 | 7 | 8 | io.toolisticon.compiletesting 9 | integration-test-java9-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-java9-unnamedAutomaticModule 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.compiletesting 20 | compiletesting 21 | 22 | 23 | 24 | junit 25 | junit 26 | test 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.apache.maven.plugins 38 | maven-jar-plugin 39 | 3.1.1 40 | 41 | 42 | 43 | integration.test.java9.unnamedautomaticmodule 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /integration-test/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-parent 5 | pom 6 | 7 | 8 | io.toolisticon.compiletesting 9 | compiletesting-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-parent 14 | 15 | 16 | junit4 17 | testng 18 | 19 | 20 | 21 | 22 | 23 | 24 | java-8 25 | 26 | [1.8,) 27 | 28 | 29 | 30 | junit5 31 | 32 | 33 | 34 | 35 | 36 | java-9 37 | 38 | [1.9,) 39 | 40 | 41 | 42 | java9 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | org.apache.maven.plugins 54 | maven-deploy-plugin 55 | 56 | true 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/CompilationResult.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.tools.DiagnosticCollector; 4 | import javax.tools.JavaFileObject; 5 | 6 | /** 7 | * Compilation result. 8 | * For internal usage. 9 | *

10 | * Allows access to DiagnosticCollector and FileManager used during compilation test. 11 | */ 12 | class CompilationResult { 13 | 14 | /** 15 | * Compilation succeeded? 16 | */ 17 | private final Boolean compilationSucceeded; 18 | /** 19 | * Diagnostics instance - allows checks for specific compilation messages 20 | */ 21 | private final DiagnosticCollector diagnostics; 22 | /** 23 | * The file manager used during the compilation - allows comparing of generated files 24 | */ 25 | private final CompileTestFileManager compileTestFileManager; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param compilationSucceeded should compilation succeed 31 | * @param diagnostics the DiagnosticsController instance to use 32 | * @param compileTestFileManager the file manager used during compilation 33 | */ 34 | CompilationResult(Boolean compilationSucceeded, 35 | DiagnosticCollector diagnostics, 36 | CompileTestFileManager compileTestFileManager) { 37 | 38 | this.compilationSucceeded = compilationSucceeded; 39 | this.diagnostics = diagnostics; 40 | this.compileTestFileManager = compileTestFileManager; 41 | 42 | } 43 | 44 | Boolean getCompilationSucceeded() { 45 | return compilationSucceeded; 46 | } 47 | 48 | DiagnosticCollector getDiagnostics() { 49 | return diagnostics; 50 | } 51 | 52 | CompileTestFileManager getCompileTestFileManager() { 53 | return compileTestFileManager; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestAnnotationProcessorClassWithoutPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.RoundEnvironment; 4 | import javax.lang.model.element.Element; 5 | import javax.lang.model.element.TypeElement; 6 | import java.lang.annotation.Annotation; 7 | import java.util.Set; 8 | 9 | /** 10 | * Base annotation processor for unit tests. 11 | * 12 | */ 13 | class UnitTestAnnotationProcessorClassWithoutPassIn extends AbstractUnitTestAnnotationProcessorClass { 14 | 15 | /** 16 | * The unit test processor instance to use. 17 | */ 18 | private final UnitTestWithoutPassIn unitTest; 19 | 20 | 21 | public UnitTestAnnotationProcessorClassWithoutPassIn(Class annotationTypeToUse, UnitTestWithoutPassIn unitTest) { 22 | super(annotationTypeToUse); 23 | 24 | this.unitTest = unitTest; 25 | } 26 | 27 | @Override 28 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 29 | 30 | // just try to execute tests if annotation is processed == annotations size is 1 31 | if (!roundEnv.processingOver() && annotations.size() == 1) { 32 | Set set = roundEnv.getElementsAnnotatedWith(annotationTypeToUse); 33 | 34 | 35 | try { 36 | unitTest.unitTest(this.processingEnv); 37 | } catch (ClassCastException e) { 38 | if (e.getMessage() != null && e.getMessage().contains("com.sun.tools.javac.code.Symbol$ClassSymbol")) { 39 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_INCOMPATIBLE_ELEMENT_TYPE.produceMessage()); 40 | } else { 41 | throw e; 42 | } 43 | } 44 | 45 | } 46 | return false; 47 | } 48 | 49 | } 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /integration-test/java9/regularTestModule/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | integration-test-java9-regularModule 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | integration-test-java9-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | integration-test-java9-regularModule 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | cute 22 | 23 | 24 | 25 | junit 26 | junit 27 | test 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-compiler-plugin 42 | 43 | 9 44 | 9 45 | 46 | 47 | 48 | 49 | 50 | org.codehaus.mojo 51 | animal-sniffer-maven-plugin 52 | ${animal-sniffer-maven-plugin.version} 53 | 54 | 55 | true 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestAnnotationProcessorClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.RoundEnvironment; 4 | import javax.lang.model.element.Element; 5 | import javax.lang.model.element.TypeElement; 6 | import java.lang.annotation.Annotation; 7 | import java.util.Set; 8 | 9 | /** 10 | * Base annotation processor for unit tests. 11 | * 12 | * @param The expected type of the processed element 13 | */ 14 | class UnitTestAnnotationProcessorClass extends AbstractUnitTestAnnotationProcessorClass { 15 | 16 | /** 17 | * The unit test processor instance to use. 18 | */ 19 | private final UnitTest unitTest; 20 | 21 | 22 | public UnitTestAnnotationProcessorClass(Class annotationTypeToUse, UnitTest unitTest) { 23 | super(annotationTypeToUse); 24 | 25 | this.unitTest = unitTest; 26 | } 27 | 28 | @Override 29 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 30 | 31 | // just try to execute tests if annotation is processed == annotations size is 1 32 | if (!roundEnv.processingOver() && annotations.size() == 1) { 33 | Set set = roundEnv.getElementsAnnotatedWith(annotationTypeToUse); 34 | 35 | ELEMENT_TYPE element_type = (ELEMENT_TYPE) getElement(set); 36 | 37 | try { 38 | unitTest.unitTest(this.processingEnv, element_type); 39 | } catch (ClassCastException e) { 40 | if (e.getMessage() != null && e.getMessage().contains("com.sun.tools.javac.code.Symbol$ClassSymbol")) { 41 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_INCOMPATIBLE_ELEMENT_TYPE.produceMessage()); 42 | } else { 43 | throw e; 44 | } 45 | } 46 | 47 | } 48 | return false; 49 | } 50 | 51 | } 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /cute/src/test/resources/AnnotationProcessorUnitTestTestClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.compiletesting.test; 2 | 3 | import io.toolisticon.cute.PassIn; 4 | 5 | import java.util.Comparator; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | * Test class for annotation processor tools. 11 | */ 12 | @PassIn 13 | public class AnnotationProcessorUnitTestTestClass { 14 | 15 | private String privateField; 16 | protected String protectedField; 17 | String packagePrivateField; 18 | public String publicField; 19 | public final String publicFinalField = ""; 20 | public static String publicStaticField; 21 | public transient String publicTransientField; 22 | 23 | enum TestEnum1 { 24 | TEST11, TEST12; 25 | } 26 | 27 | public enum TestEnum2 { 28 | TEST21, TEST22; 29 | } 30 | 31 | public static class EmbeddedStaticClass { 32 | 33 | } 34 | 35 | public Comparator comparatorWithAnonymousClass = new Comparator() { 36 | @Override 37 | public int compare(Long o1, Long o2) { 38 | return 0; 39 | } 40 | }; 41 | 42 | 43 | public class EmbeddedClass { 44 | 45 | } 46 | 47 | public class EmbeddedClassWithNoNoargConstructor { 48 | 49 | public EmbeddedClassWithNoNoargConstructor(String abs) { 50 | 51 | } 52 | 53 | } 54 | 55 | public abstract class AbstractEmbeddedClass { 56 | 57 | public abstract void abstractMethod(); 58 | 59 | } 60 | 61 | { 62 | int x = 0; 63 | } 64 | 65 | static { 66 | int y = 0; 67 | } 68 | 69 | public AnnotationProcessorUnitTestTestClass() { 70 | 71 | } 72 | 73 | public AnnotationProcessorUnitTestTestClass(String withParameter) { 74 | 75 | } 76 | 77 | public String methodWithReturnTypeAndParameters(Boolean first, String second) { 78 | return ""; 79 | } 80 | 81 | 82 | public int testGenericsOnParameter(Map> o1, Map>> o2) { 83 | return 0; 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /integration-test/java9/regularTestModule/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-java9-regularModule 5 | jar 6 | 7 | 8 | io.toolisticon.compiletesting 9 | integration-test-java9-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-java9-regularModule 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.compiletesting 20 | compiletesting 21 | 22 | 23 | 24 | junit 25 | junit 26 | test 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | org.apache.maven.plugins 40 | maven-compiler-plugin 41 | 42 | 9 43 | 9 44 | 45 | 46 | 47 | 48 | 49 | org.codehaus.mojo 50 | animal-sniffer-maven-plugin 51 | ${animal-sniffer-maven-plugin.version} 52 | 53 | 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | org.apache.felix 62 | maven-bundle-plugin 63 | 64 | 65 | true 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/CuteClassLoaderImpl.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.tools.JavaFileObject; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | import java.util.regex.Matcher; 8 | import java.util.regex.Pattern; 9 | import java.util.stream.Collectors; 10 | 11 | class CuteClassLoaderImpl extends ClassLoader implements CuteClassLoader { 12 | 13 | final CompileTestFileManager compileTestFileManager; 14 | 15 | final Map classMap = new HashMap<>(); 16 | 17 | public CuteClassLoaderImpl(CompileTestFileManager compileTestFileManager) { 18 | this.compileTestFileManager = compileTestFileManager; 19 | 20 | // get classes 21 | List javaFileObjectList = compileTestFileManager.getGeneratedJavaFileObjects().stream() 22 | .filter(e -> e.getKind() == JavaFileObject.Kind.CLASS) 23 | .collect(Collectors.toList()); 24 | 25 | for (CompileTestFileManager.InMemoryOutputJavaFileObject javaFileObject : javaFileObjectList) { 26 | 27 | String className = convertJavaFileObjectNameToBinaryClassName(javaFileObject); 28 | classMap.put(className, javaFileObject); 29 | 30 | } 31 | 32 | } 33 | 34 | 35 | static String convertJavaFileObjectNameToBinaryClassName(JavaFileObject javaFileObject) { 36 | Pattern pattern = Pattern.compile("^/(.*)[.]class$"); 37 | Matcher matcher = pattern.matcher(javaFileObject.getName()); 38 | if (matcher.matches()) { 39 | return matcher.group(1).replaceAll("/", "."); 40 | } 41 | throw new IllegalStateException("Got invalid name : " + javaFileObject.getName()); 42 | } 43 | 44 | @Override 45 | protected Class findClass(String name) throws ClassNotFoundException { 46 | 47 | if (!classMap.containsKey(name)) { 48 | throw new ClassNotFoundException("Couldn't find class : " + name); 49 | } 50 | 51 | CompileTestFileManager.InMemoryOutputJavaFileObject javaFileObject = classMap.get(name); 52 | 53 | return defineClass(name, javaFileObject.getContent(), 0, javaFileObject.getContent().length); 54 | } 55 | 56 | @Override 57 | public Class getClass(String binaryClassName) throws ClassNotFoundException { 58 | return this.loadClass(binaryClassName); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/AbstractUnitTestAnnotationProcessorClass.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.ProcessingEnvironment; 5 | import javax.lang.model.element.Element; 6 | import javax.tools.Diagnostic; 7 | import java.lang.annotation.Annotation; 8 | import java.util.ArrayList; 9 | import java.util.HashSet; 10 | import java.util.List; 11 | import java.util.Set; 12 | 13 | /** 14 | * Abstract base class that 15 | */ 16 | abstract class AbstractUnitTestAnnotationProcessorClass extends AbstractProcessor { 17 | 18 | private final Set supportedAnnotationTypes = new HashSet<>(); 19 | 20 | /** 21 | * The annotation type to search for. 22 | */ 23 | protected Class annotationTypeToUse; 24 | 25 | 26 | AbstractUnitTestAnnotationProcessorClass(Class annotationTypeToUse) { 27 | this.annotationTypeToUse = annotationTypeToUse; 28 | this.supportedAnnotationTypes.add(annotationTypeToUse.getCanonicalName()); 29 | } 30 | 31 | @Override 32 | public Set getSupportedAnnotationTypes() { 33 | return supportedAnnotationTypes; 34 | } 35 | 36 | @Override 37 | public synchronized void init(ProcessingEnvironment processingEnv) { 38 | super.init(processingEnv); 39 | } 40 | 41 | 42 | protected Element getElement(Set elements) { 43 | 44 | if (elements.size() == 1) { 45 | return elements.iterator().next(); 46 | } else if (elements.isEmpty()) { 47 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_MUST_FIND_ONE_ELEMENT.produceMessage()); 48 | } else { 49 | 50 | List filteredList = new ArrayList<>(); 51 | for (T element : elements) { 52 | 53 | if (element.getAnnotation(PassIn.class) != null) { 54 | filteredList.add(element); 55 | } 56 | 57 | } 58 | 59 | if (filteredList.isEmpty()) { 60 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_MUST_FIND_EXACTLY_ONE_ELEMENT.produceMessage(annotationTypeToUse.getCanonicalName())); 61 | } else if (filteredList.size() > 1) { 62 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_MUST_FIND_EXACTLY_ONE_ELEMENT_WITH_PASSIN_ANNOTATION.produceMessage()); 63 | } else { 64 | return filteredList.get(0); 65 | } 66 | 67 | } 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestAnnotationProcessorClassForTestingAnnotationProcessorsWithoutPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.ProcessingEnvironment; 4 | import javax.annotation.processing.Processor; 5 | import javax.annotation.processing.RoundEnvironment; 6 | import javax.lang.model.element.TypeElement; 7 | import java.lang.annotation.Annotation; 8 | import java.util.Set; 9 | 10 | /** 11 | * Base annotation processor for unit testing of initialized annotation processors. 12 | * 13 | * @param the unit test processor to use 14 | */ 15 | class UnitTestAnnotationProcessorClassForTestingAnnotationProcessorsWithoutPassIn extends AbstractUnitTestAnnotationProcessorClass { 16 | 17 | 18 | /** 19 | * The unit test processor instance to use. 20 | */ 21 | private final UnitTestForTestingAnnotationProcessorsWithoutPassIn unitTestForTestingAnnotationProcessors; 22 | private final UNIT_PROCESSOR processorUnderTest; 23 | 24 | 25 | public UnitTestAnnotationProcessorClassForTestingAnnotationProcessorsWithoutPassIn(UNIT_PROCESSOR processorUnderTest, Class annotationTypeToUse, UnitTestForTestingAnnotationProcessorsWithoutPassIn unitTestForTestingAnnotationProcessors) { 26 | super(annotationTypeToUse); 27 | this.processorUnderTest = processorUnderTest; 28 | this.unitTestForTestingAnnotationProcessors = unitTestForTestingAnnotationProcessors; 29 | } 30 | 31 | @Override 32 | public synchronized void init(ProcessingEnvironment processingEnv) { 33 | super.init(processingEnv); 34 | 35 | // call init method of annotation processor under test 36 | processorUnderTest.init(processingEnv); 37 | } 38 | 39 | @Override 40 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 41 | 42 | // just try to execute tests if annotation is processed == annotations size is 1 43 | if (!roundEnv.processingOver() && annotations.size() == 1) { 44 | 45 | try { 46 | unitTestForTestingAnnotationProcessors.unitTest(processorUnderTest, this.processingEnv); 47 | } catch (ClassCastException e) { 48 | if (e.getMessage() != null && e.getMessage().contains("com.sun.tools.javac.code.Symbol$ClassSymbol")) { 49 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_INCOMPATIBLE_ELEMENT_TYPE.produceMessage()); 50 | } else { 51 | throw e; 52 | } 53 | } 54 | 55 | 56 | } 57 | 58 | return false; 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/common/SimpleTestProcessor1.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.common; 2 | 3 | import javax.annotation.processing.AbstractProcessor; 4 | import javax.annotation.processing.ProcessingEnvironment; 5 | import javax.annotation.processing.RoundEnvironment; 6 | import javax.lang.model.element.Element; 7 | import javax.lang.model.element.TypeElement; 8 | import javax.tools.JavaFileObject; 9 | import java.io.BufferedWriter; 10 | import java.io.IOException; 11 | import java.util.Arrays; 12 | import java.util.HashSet; 13 | import java.util.Set; 14 | 15 | 16 | public class SimpleTestProcessor1 extends AbstractProcessor { 17 | @Override 18 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 19 | 20 | for (Element element : roundEnv.getElementsAnnotatedWith(SimpleTestAnnotation1.class)){ 21 | 22 | // generate file 23 | TypeElement typeElement = (TypeElement) element; 24 | String packageName = processingEnv.getElementUtils().getPackageOf(typeElement).getQualifiedName().toString(); 25 | String simpleName = typeElement.getSimpleName() + "GeneratedClass"; 26 | String className = typeElement.getQualifiedName() + "GeneratedClass"; 27 | String value = typeElement.getAnnotation(SimpleTestAnnotation1.class).value(); 28 | 29 | try { 30 | JavaFileObject javaFileObject = processingEnv.getFiler().createSourceFile(className, element); 31 | 32 | BufferedWriter bufferWriter = new BufferedWriter(javaFileObject.openWriter()); 33 | bufferWriter.write("package " + packageName + ";"); 34 | bufferWriter.newLine(); 35 | bufferWriter.write("import " + SimpleTestProcessor1Interface.class.getCanonicalName() + ";"); 36 | bufferWriter.newLine(); 37 | bufferWriter.write("public class " + simpleName + " implements " + SimpleTestProcessor1Interface.class.getSimpleName() + "{"); 38 | bufferWriter.newLine(); 39 | bufferWriter.write("public String getOutput (){return \"" + value + "\";}"); 40 | bufferWriter.newLine(); 41 | bufferWriter.write("}"); 42 | bufferWriter.flush(); 43 | bufferWriter.close(); 44 | 45 | } catch (IOException e) { 46 | throw new RuntimeException(e); 47 | } 48 | 49 | } 50 | 51 | return false; 52 | } 53 | 54 | 55 | @Override 56 | public Set getSupportedAnnotationTypes() { 57 | 58 | return new HashSet(Arrays.asList(SimpleTestAnnotation1.class.getCanonicalName())); 59 | 60 | } 61 | 62 | public ProcessingEnvironment getProcessingEnvironment() { 63 | return this.processingEnv; 64 | } 65 | } -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/matchers/BinaryGeneratedFileObjectMatcher.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.Constants; 4 | import io.toolisticon.cute.FailingAssertionException; 5 | import io.toolisticon.cute.GeneratedFileObjectMatcher; 6 | 7 | import javax.tools.FileObject; 8 | import java.io.BufferedInputStream; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.util.Objects; 12 | import java.util.regex.PatternSyntaxException; 13 | 14 | /** 15 | * Validates if a generated two FileObjects are equal by using binary comparision. 16 | */ 17 | public class BinaryGeneratedFileObjectMatcher implements GeneratedFileObjectMatcher { 18 | 19 | final FileObject expectedFileObject; 20 | 21 | /** 22 | * Hidden constructor. 23 | * 24 | * @param expectedFileObject the expected java file object 25 | * @throws PatternSyntaxException If the expression's syntax is invalid 26 | */ 27 | BinaryGeneratedFileObjectMatcher(FileObject expectedFileObject) { 28 | 29 | this.expectedFileObject = expectedFileObject; 30 | 31 | } 32 | 33 | @Override 34 | public boolean check(FileObject fileObject) throws IOException { 35 | 36 | // Must not be null 37 | if (fileObject == null) { 38 | return false; 39 | } 40 | 41 | if (!contentEquals(fileObject.openInputStream(), expectedFileObject.openInputStream())) { 42 | throw new FailingAssertionException(Constants.Messages.GFOM_FILEOBJECTS_ARENT_EQUAL_BY_BINARY_COMPARISION.produceMessage()); 43 | } 44 | 45 | return true; 46 | } 47 | 48 | static boolean contentEquals(InputStream input1, InputStream input2) throws IOException { 49 | 50 | if (!(input1 instanceof BufferedInputStream)) { 51 | input1 = new BufferedInputStream(input1); 52 | } 53 | if (!(input2 instanceof BufferedInputStream)) { 54 | input2 = new BufferedInputStream(input2); 55 | } 56 | 57 | int ch = input1.read(); 58 | while (-1 != ch) { 59 | int ch2 = input2.read(); 60 | if (ch != ch2) { 61 | return false; 62 | } 63 | ch = input1.read(); 64 | } 65 | 66 | int ch2 = input2.read(); 67 | return (ch2 == -1); 68 | } 69 | 70 | @Override 71 | public boolean equals(Object o) { 72 | if (this == o) return true; 73 | if (o == null || getClass() != o.getClass()) return false; 74 | 75 | BinaryGeneratedFileObjectMatcher that = (BinaryGeneratedFileObjectMatcher) o; 76 | 77 | return Objects.equals(expectedFileObject, that.expectedFileObject); 78 | } 79 | 80 | @Override 81 | public int hashCode() { 82 | return expectedFileObject != null ? expectedFileObject.hashCode() : 0; 83 | } 84 | } -------------------------------------------------------------------------------- /integration-test/java9/test/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | integration-test-java9-test 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | integration-test-java9-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | integration-test-java9-test 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | cute 22 | 23 | 24 | 25 | junit 26 | junit 27 | test 28 | 29 | 30 | 31 | io.toolisticon.cute 32 | integration-test-java9-regularModule 33 | ${project.version} 34 | 35 | 36 | 37 | io.toolisticon.cute 38 | integration-test-java9-namedAutomaticModule 39 | ${project.version} 40 | 41 | 42 | 43 | io.toolisticon.cute 44 | integration-test-java9-unnamedAutomaticModule 45 | ${project.version} 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | org.apache.maven.plugins 56 | maven-compiler-plugin 57 | 58 | 9 59 | 9 60 | 61 | 62 | 63 | 64 | 65 | org.codehaus.mojo 66 | animal-sniffer-maven-plugin 67 | ${animal-sniffer-maven-plugin.version} 68 | 69 | 70 | true 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | maven-enforcer-plugin 80 | 81 | true 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /extension/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | extension-parent 5 | pom 6 | 7 | 8 | io.toolisticon.cute 9 | cute-parent 10 | 1.9.1-SNAPSHOT 11 | 12 | 13 | extension-parent 14 | 15 | 16 | api 17 | plainjava 18 | junit4 19 | testng 20 | 21 | 22 | 23 | 24 | 25 | 26 | java-8 27 | 28 | [1.8,) 29 | 30 | 31 | 32 | junit5 33 | 34 | 35 | 36 | 37 | java-9 38 | 39 | [9,) 40 | 41 | 42 | 43 | modulesupport 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | maven-enforcer-plugin 57 | 58 | 59 | enforce 60 | 61 | enforce 62 | 63 | 64 | 65 | 66 | [3.0.0,) 67 | 68 | 69 | 1.6 70 | 71 | 72 | false 73 | 74 | * 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestAnnotationProcessorClassForTestingAnnotationProcessorsWithPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.ProcessingEnvironment; 4 | import javax.annotation.processing.Processor; 5 | import javax.annotation.processing.RoundEnvironment; 6 | import javax.lang.model.element.Element; 7 | import javax.lang.model.element.TypeElement; 8 | import java.lang.annotation.Annotation; 9 | import java.util.Set; 10 | 11 | /** 12 | * Base annotation processor for unit testing of initialized annotation processors. 13 | * 14 | * @param the unit test processor to use 15 | * @param The expected type of the processed element 16 | */ 17 | class UnitTestAnnotationProcessorClassForTestingAnnotationProcessorsWithPassIn extends AbstractUnitTestAnnotationProcessorWithPassIn { 18 | 19 | /** 20 | * The unit test processor instance to use. 21 | */ 22 | private final UnitTestForTestingAnnotationProcessors unitTestForTestingAnnotationProcessors; 23 | private final UNIT_PROCESSOR processorUnderTest; 24 | 25 | 26 | public UnitTestAnnotationProcessorClassForTestingAnnotationProcessorsWithPassIn(UNIT_PROCESSOR processorUnderTest, Class annotationTypeToUse, Class classToScan, Class annotationTypeUsedForScan, UnitTestForTestingAnnotationProcessors unitTestForTestingAnnotationProcessors) { 27 | super(annotationTypeToUse, classToScan, annotationTypeUsedForScan); 28 | this.processorUnderTest = processorUnderTest; 29 | this.unitTestForTestingAnnotationProcessors = unitTestForTestingAnnotationProcessors; 30 | } 31 | 32 | @Override 33 | public synchronized void init(ProcessingEnvironment processingEnv) { 34 | super.init(processingEnv); 35 | 36 | // call init method of annotation processor under test 37 | processorUnderTest.init(processingEnv); 38 | } 39 | 40 | 41 | @Override 42 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 43 | 44 | // just try to execute tests if annotation is processed == annotations size is 1 45 | if (!roundEnv.processingOver() && annotations.size() == 1) { 46 | 47 | try { 48 | unitTestForTestingAnnotationProcessors.unitTest(processorUnderTest, this.processingEnv, (ELEMENT_TYPE) getPassedInElement()); 49 | } catch (ClassCastException e) { 50 | if (e.getMessage() != null && e.getMessage().contains("com.sun.tools.javac.code.Symbol$ClassSymbol")) { 51 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_INCOMPATIBLE_ELEMENT_TYPE.produceMessage()); 52 | } else { 53 | throw e; 54 | } 55 | } 56 | 57 | } 58 | 59 | return false; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/UnitTestAnnotationProcessorClassForTestingAnnotationProcessors.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.annotation.processing.ProcessingEnvironment; 4 | import javax.annotation.processing.Processor; 5 | import javax.annotation.processing.RoundEnvironment; 6 | import javax.lang.model.element.Element; 7 | import javax.lang.model.element.TypeElement; 8 | import java.lang.annotation.Annotation; 9 | import java.util.Set; 10 | 11 | /** 12 | * Base annotation processor for unit testing of initialized annotation processors. 13 | * 14 | * @param the unit test processor to use 15 | * @param The expected type of the processed element 16 | */ 17 | class UnitTestAnnotationProcessorClassForTestingAnnotationProcessors extends AbstractUnitTestAnnotationProcessorClass { 18 | 19 | 20 | /** 21 | * The unit test processor instance to use. 22 | */ 23 | private final UnitTestForTestingAnnotationProcessors unitTestForTestingAnnotationProcessors; 24 | private final UNIT_PROCESSOR processorUnderTest; 25 | 26 | 27 | public UnitTestAnnotationProcessorClassForTestingAnnotationProcessors(UNIT_PROCESSOR processorUnderTest, Class annotationTypeToUse, UnitTestForTestingAnnotationProcessors unitTestForTestingAnnotationProcessors) { 28 | super(annotationTypeToUse); 29 | this.processorUnderTest = processorUnderTest; 30 | this.unitTestForTestingAnnotationProcessors = unitTestForTestingAnnotationProcessors; 31 | } 32 | 33 | @Override 34 | public synchronized void init(ProcessingEnvironment processingEnv) { 35 | super.init(processingEnv); 36 | 37 | // call init method of annotation processor under test 38 | processorUnderTest.init(processingEnv); 39 | } 40 | 41 | @Override 42 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 43 | 44 | // just try to execute tests if annotation is processed == annotations size is 1 45 | if (!roundEnv.processingOver() && annotations.size() == 1) { 46 | 47 | Set set = roundEnv.getElementsAnnotatedWith(annotationTypeToUse); 48 | 49 | ELEMENT_TYPE element = (ELEMENT_TYPE) getElement(set); 50 | 51 | try { 52 | unitTestForTestingAnnotationProcessors.unitTest(processorUnderTest, this.processingEnv, element); 53 | } catch (ClassCastException e) { 54 | if (e.getMessage() != null && e.getMessage().contains("com.sun.tools.javac.code.Symbol$ClassSymbol")) { 55 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PRECONDITION_INCOMPATIBLE_ELEMENT_TYPE.produceMessage()); 56 | } else { 57 | throw e; 58 | } 59 | } 60 | 61 | 62 | } 63 | 64 | return false; 65 | } 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/matchers/CoreGeneratedFileObjectMatchers.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.Constants; 4 | import io.toolisticon.cute.GeneratedFileObjectMatcher; 5 | 6 | import javax.tools.FileObject; 7 | import java.util.regex.PatternSyntaxException; 8 | 9 | /** 10 | * Convenience method to create core matchers for checking 11 | */ 12 | public final class CoreGeneratedFileObjectMatchers { 13 | 14 | /** 15 | * Hidden constructor. 16 | */ 17 | private CoreGeneratedFileObjectMatchers() { 18 | 19 | } 20 | 21 | /** 22 | * Static function to create a {@link RegexGeneratedFileObjectMatcher} instance. 23 | * 24 | * @param pattern a valid pattern string 25 | * @return the instance 26 | * @throws PatternSyntaxException If the expression's syntax is invalid 27 | * @throws IllegalArgumentException if passed pattern is null 28 | */ 29 | public static GeneratedFileObjectMatcher createRegexMatcher(String pattern) { 30 | 31 | if (pattern == null) { 32 | throw new IllegalArgumentException(Constants.Messages.IAE_PASSED_PARAMETER_MUST_NOT_BE_NULL.produceMessage("pattern")); 33 | } 34 | 35 | return new RegexGeneratedFileObjectMatcher(pattern); 36 | } 37 | 38 | /** 39 | * Static function to create a {@link ContainsStringsGeneratedFileObjectMatcher} instance. 40 | * 41 | * @return the instance 42 | * @throws PatternSyntaxException If the expression's syntax is invalid 43 | */ 44 | public static GeneratedFileObjectMatcher createContainsSubstringsMatcher(String... stringsToSearch) { 45 | return new ContainsStringsGeneratedFileObjectMatcher(stringsToSearch); 46 | } 47 | 48 | 49 | /** 50 | * Static function to create a {@link WellFormedXmlGeneratedFileObjectMatcher} instance. 51 | * 52 | * @return the instance 53 | * @throws PatternSyntaxException If the expression's syntax is invalid 54 | */ 55 | public static GeneratedFileObjectMatcher createIsWellFormedXmlMatcher() { 56 | return new WellFormedXmlGeneratedFileObjectMatcher(); 57 | } 58 | 59 | public static GeneratedFileObjectMatcher createIgnoreLineEndingsMatcher(T expectedFileObject) { 60 | 61 | if (expectedFileObject == null) { 62 | throw new IllegalArgumentException(Constants.Messages.IAE_PASSED_PARAMETER_MUST_NOT_BE_NULL.produceMessage("expected fileobject")); 63 | } 64 | 65 | return new IgnoreLineEndingsGeneratedFileObjectMatcher(expectedFileObject); 66 | } 67 | 68 | public static GeneratedFileObjectMatcher createBinaryMatcher(T expectedFileObject) { 69 | 70 | if (expectedFileObject == null) { 71 | throw new IllegalArgumentException(Constants.Messages.IAE_PASSED_PARAMETER_MUST_NOT_BE_NULL.produceMessage("expected fileobject")); 72 | } 73 | 74 | return new BinaryGeneratedFileObjectMatcher(expectedFileObject); 75 | } 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/CompileTestUtilities.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | 4 | import javax.annotation.processing.Processor; 5 | import javax.tools.Diagnostic; 6 | import javax.tools.DiagnosticCollector; 7 | import javax.tools.JavaFileObject; 8 | import java.util.HashSet; 9 | import java.util.Set; 10 | import java.util.stream.Collectors; 11 | 12 | /** 13 | * Some static utility functions. 14 | */ 15 | final class CompileTestUtilities { 16 | 17 | static final String ANONYMOUS_CLASS = "ANONYMOUS CLASS<%s>"; 18 | final static String TEMPLATE_ANNOTATION_PROCESSOR_WAS_APPLIED = "!!!--- ANNOTATION PROCESSOR (%s)<#%s> WAS APPPLIED ---!!!"; 19 | 20 | /** 21 | * Hidden constructor. 22 | */ 23 | private CompileTestUtilities() { 24 | 25 | } 26 | 27 | /** 28 | * Produces messages string depending on passed processor to check if processor has been applied. 29 | * 30 | * @param processor the processor to create the message for 31 | * @return the message to check if processor has been applied 32 | */ 33 | static String getAnnotationProcessorWasAppliedMessage(Processor processor) { 34 | return String.format(TEMPLATE_ANNOTATION_PROCESSOR_WAS_APPLIED, 35 | processor != null && processor.getClass() != null ? ( 36 | processor.getClass().getCanonicalName() != null ? 37 | processor.getClass().getCanonicalName() : 38 | String.format(ANONYMOUS_CLASS, 39 | Object.class.equals(processor.getClass().getSuperclass()) ? 40 | Processor.class.getCanonicalName() 41 | : processor.getClass().getSuperclass().getCanonicalName() 42 | ) 43 | ) : "", 44 | processor != null ? System.identityHashCode(processor) : "NULL"); 45 | } 46 | 47 | /** 48 | * Gets all messages of a specific kind. 49 | * 50 | * @param diagnostics the compilations diagnostics result 51 | * @param kind the kind of the messages to return 52 | * @return a Set containing all messages of passed kind, or an empty Set. 53 | */ 54 | static Set getMessages(DiagnosticCollector diagnostics, Diagnostic.Kind kind) { 55 | 56 | return getDiagnosticByKind(diagnostics,kind).stream().map(e -> e.getMessage(null)).collect(Collectors.toSet()); 57 | 58 | } 59 | 60 | /** 61 | * Filters Diagnostics by kind. 62 | * 63 | * @param diagnostics the compilations diagnostics result 64 | * @param kind the kind of the messages to return 65 | * @return a Set containing all Diagnostic element of passed kind, or an empty Set. 66 | */ 67 | static Set> getDiagnosticByKind(DiagnosticCollector diagnostics, Diagnostic.Kind kind) { 68 | 69 | return diagnostics.getDiagnostics().stream().filter(e -> e.getKind().equals(kind)).collect(Collectors.toSet()); 70 | 71 | } 72 | 73 | 74 | } -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/matchers/IgnoreLineEndingsGeneratedFileObjectMatcher.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.Constants; 4 | import io.toolisticon.cute.FailingAssertionException; 5 | import io.toolisticon.cute.GeneratedFileObjectMatcher; 6 | 7 | import javax.tools.FileObject; 8 | import java.io.BufferedReader; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.io.InputStreamReader; 12 | import java.util.Objects; 13 | import java.util.regex.PatternSyntaxException; 14 | 15 | /** 16 | * Validates if file objects are matching. 17 | * Does validation line by line and ignores line endings. 18 | * (this is good for text files since windows and linux operation-systems are using different line endings) 19 | */ 20 | public class IgnoreLineEndingsGeneratedFileObjectMatcher implements GeneratedFileObjectMatcher { 21 | 22 | final FileObject expectedFileObject; 23 | 24 | /** 25 | * Hidden constructor. 26 | * 27 | * @param expectedFileObject the expected java file object 28 | * @throws PatternSyntaxException If the expression's syntax is invalid 29 | */ 30 | IgnoreLineEndingsGeneratedFileObjectMatcher(FileObject expectedFileObject) { 31 | 32 | this.expectedFileObject = expectedFileObject; 33 | 34 | } 35 | 36 | @Override 37 | public boolean check(FileObject fileObject) throws IOException { 38 | 39 | if (!contentEquals(fileObject.openInputStream(), expectedFileObject.openInputStream())) { 40 | throw new FailingAssertionException(Constants.Messages.GFOM_FILEOBJECTS_ARENT_EQUAL_BY_TEXTUAL_COMPARISION_WITH_IGNORE_LINEENDINGS.produceMessage()); 41 | } 42 | 43 | return true; 44 | } 45 | 46 | 47 | static boolean contentEquals(InputStream input1, InputStream input2) throws IOException { 48 | 49 | BufferedReader br1 = new BufferedReader(new InputStreamReader(input1)); 50 | BufferedReader br2 = new BufferedReader(new InputStreamReader(input2)); 51 | 52 | String br1line; 53 | String br2line; 54 | do { 55 | br1line = br1.readLine(); 56 | br2line = br2.readLine(); 57 | 58 | 59 | if (br1line != null && br2line != null && br1line != br2line) { 60 | 61 | if (!br1line.equals(br2line)) { 62 | return false; 63 | } 64 | 65 | } else if (br1line != null || br2line != null) { 66 | return false; 67 | } 68 | 69 | } while (br1line != null && br2line != null); 70 | 71 | return true; 72 | } 73 | 74 | @Override 75 | public boolean equals(Object o) { 76 | if (this == o) return true; 77 | if (o == null || getClass() != o.getClass()) return false; 78 | 79 | IgnoreLineEndingsGeneratedFileObjectMatcher that = (IgnoreLineEndingsGeneratedFileObjectMatcher) o; 80 | 81 | return Objects.equals(expectedFileObject, that.expectedFileObject); 82 | } 83 | 84 | @Override 85 | public int hashCode() { 86 | return expectedFileObject != null ? expectedFileObject.hashCode() : 0; 87 | } 88 | } 89 | 90 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/integrationtest/ProcessorWasAppliedTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest; 2 | 3 | import io.toolisticon.cute.Cute; 4 | import io.toolisticon.cute.JavaFileObjectUtils; 5 | import io.toolisticon.cute.common.SimpleTestProcessor1; 6 | import io.toolisticon.cute.common.SimpleTestProcessor2; 7 | import org.hamcrest.MatcherAssert; 8 | import org.hamcrest.Matchers; 9 | import org.junit.Test; 10 | 11 | /** 12 | * Integration test to check if annotation processor was detected as applied correctly. 13 | */ 14 | public class ProcessorWasAppliedTest { 15 | 16 | @Test 17 | public void concreteProcessorClassInstance_wasApplied() { 18 | 19 | Cute.blackBoxTest() 20 | .given().processor(SimpleTestProcessor1.class) 21 | .andSourceFiles(JavaFileObjectUtils.readFromResource("/integrationtest/AnnotationProcessorAppliedTestClass.java")) 22 | .whenCompiled() 23 | .thenExpectThat().compilationSucceeds() 24 | .executeTest(); 25 | 26 | } 27 | 28 | @Test 29 | public void concreteProcessorClassInstance_wasNotApplied() { 30 | boolean assertionErrorWasTriggered = false; 31 | try { 32 | Cute.blackBoxTest() 33 | .given().processor(SimpleTestProcessor2.class) 34 | .andSourceFiles(JavaFileObjectUtils.readFromResource("/integrationtest/AnnotationProcessorAppliedTestClass.java")) 35 | .executeTest(); 36 | 37 | } catch (AssertionError e) { 38 | assertionErrorWasTriggered = true; 39 | 40 | MatcherAssert.assertThat(e.getMessage(), Matchers.containsString("Annotation processor " + SimpleTestProcessor2.class.getCanonicalName() + " hasn't been called")); 41 | 42 | } 43 | 44 | MatcherAssert.assertThat("AssertionError should have been triggered", assertionErrorWasTriggered); 45 | 46 | } 47 | 48 | @Test 49 | public void anonymousProcessorClassInstanceOfClass_wasApplied() { 50 | 51 | Cute.blackBoxTest() 52 | .given().processor(SimpleTestProcessor1.class) 53 | .andSourceFiles(JavaFileObjectUtils.readFromResource("/integrationtest/AnnotationProcessorAppliedTestClass.java")) 54 | .executeTest(); 55 | 56 | } 57 | 58 | @Test 59 | public void anonymousProcessorClassInstanceOfClass_wasNotApplied() { 60 | 61 | boolean assertionErrorWasTriggered = false; 62 | try { 63 | 64 | Cute.blackBoxTest() 65 | .given().processor(SimpleTestProcessor2.class) 66 | .andSourceFiles(JavaFileObjectUtils.readFromResource("/integrationtest/AnnotationProcessorAppliedTestClass.java")) 67 | .executeTest(); 68 | 69 | } catch (AssertionError e) { 70 | assertionErrorWasTriggered = true; 71 | MatcherAssert.assertThat(e.getMessage(), Matchers.containsString("Annotation processor " + SimpleTestProcessor2.class.getCanonicalName() + " hasn't been called")); 72 | 73 | } 74 | 75 | MatcherAssert.assertThat("AssertionError should have been triggered", assertionErrorWasTriggered); 76 | 77 | 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /integration-test/junit5/src/test/java/io/toolisticon/cute/integrationtest/junit5/Junit5Test.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.junit5; 2 | 3 | 4 | import io.toolisticon.cute.Cute; 5 | import io.toolisticon.cute.UnitTestWithoutPassIn; 6 | import io.toolisticon.cute.extension.api.AssertionSpiServiceLocator; 7 | import io.toolisticon.cute.extension.junit5.JUnit5Assertion; 8 | import org.hamcrest.MatcherAssert; 9 | import org.hamcrest.Matchers; 10 | import org.junit.jupiter.api.Assertions; 11 | import org.junit.jupiter.api.Test; 12 | 13 | import javax.annotation.processing.ProcessingEnvironment; 14 | import javax.tools.Diagnostic; 15 | 16 | /** 17 | * Test class to test testng extension. 18 | */ 19 | public class Junit5Test { 20 | 21 | @Test 22 | public void testServiceLocator() { 23 | 24 | MatcherAssert.assertThat(AssertionSpiServiceLocator.locate().getClass(), Matchers.is((Class) JUnit5Assertion.class)); 25 | 26 | } 27 | 28 | @Test 29 | public void warningMessageTest() { 30 | 31 | Cute 32 | .unitTest() 33 | .when(new UnitTestWithoutPassIn() { 34 | @Override 35 | public void unitTest(ProcessingEnvironment processingEnvironment) { 36 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "WARNING!"); 37 | } 38 | }) 39 | .thenExpectThat() 40 | .compilationSucceeds() 41 | .andThat().compilerMessage().ofKindWarning().contains("WARNING!") 42 | .executeTest(); 43 | 44 | 45 | } 46 | 47 | @Test 48 | public void successfulFailingCompilationTest_ByErrorMessage() { 49 | 50 | Cute 51 | .unitTest() 52 | .when(new UnitTestWithoutPassIn() { 53 | @Override 54 | public void unitTest(ProcessingEnvironment processingEnvironment) { 55 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR, "ERROR!"); 56 | } 57 | }) 58 | .thenExpectThat() 59 | .compilationFails() 60 | .andThat().compilerMessage().ofKindError().contains("ERROR!") 61 | .executeTest(); 62 | 63 | 64 | } 65 | 66 | @Test 67 | public void failingCompilationTest_ByErrorMessage() { 68 | 69 | try { 70 | Cute 71 | .unitTest() 72 | .when(new UnitTestWithoutPassIn() { 73 | @Override 74 | public void unitTest(ProcessingEnvironment processingEnvironment) { 75 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR, "ERROR!"); 76 | } 77 | }) 78 | .thenExpectThat().compilationSucceeds() 79 | .executeTest(); 80 | 81 | Assertions.fail("Should have failed"); 82 | } catch (AssertionError error) { 83 | Assertions.assertTrue(error.getMessage().startsWith("Compilation should have succeeded but failed")); 84 | } 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/matchers/CoreGeneratedFileObjectMatchersTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.matchers; 2 | 3 | import io.toolisticon.cute.GeneratedFileObjectMatcher; 4 | import org.hamcrest.MatcherAssert; 5 | import org.hamcrest.Matchers; 6 | import org.junit.Test; 7 | import org.mockito.Mockito; 8 | 9 | import javax.tools.FileObject; 10 | import java.util.Arrays; 11 | 12 | public class CoreGeneratedFileObjectMatchersTest { 13 | 14 | @Test 15 | public void createRegexMatcher() { 16 | 17 | GeneratedFileObjectMatcher unit = CoreGeneratedFileObjectMatchers.createRegexMatcher("ABC"); 18 | MatcherAssert.assertThat(unit, Matchers.isA(RegexGeneratedFileObjectMatcher.class)); 19 | MatcherAssert.assertThat(((RegexGeneratedFileObjectMatcher) unit).patternString, Matchers.is("ABC")); 20 | 21 | } 22 | 23 | @Test(expected = IllegalArgumentException.class) 24 | public void createRegexMatcher_nullValuedPattern() { 25 | 26 | CoreGeneratedFileObjectMatchers.createRegexMatcher(null); 27 | 28 | } 29 | 30 | @Test 31 | public void createContainsSubstringsMatcher() { 32 | 33 | GeneratedFileObjectMatcher unit = CoreGeneratedFileObjectMatchers.createContainsSubstringsMatcher("ABC", "DEF"); 34 | MatcherAssert.assertThat(unit, Matchers.isA(ContainsStringsGeneratedFileObjectMatcher.class)); 35 | MatcherAssert.assertThat(Arrays.asList(((ContainsStringsGeneratedFileObjectMatcher) unit).stringsToCheck), Matchers.contains("ABC", "DEF")); 36 | 37 | } 38 | 39 | @Test 40 | public void createIsWellFormedXmlMatcher() { 41 | 42 | GeneratedFileObjectMatcher unit = CoreGeneratedFileObjectMatchers.createIsWellFormedXmlMatcher(); 43 | MatcherAssert.assertThat(unit, Matchers.isA(WellFormedXmlGeneratedFileObjectMatcher.class)); 44 | 45 | } 46 | 47 | @Test 48 | public void createIgnoreLineEndingsMatcher() { 49 | 50 | FileObject fo = Mockito.mock(FileObject.class); 51 | GeneratedFileObjectMatcher unit = CoreGeneratedFileObjectMatchers.createIgnoreLineEndingsMatcher(fo); 52 | MatcherAssert.assertThat(unit, Matchers.isA(IgnoreLineEndingsGeneratedFileObjectMatcher.class)); 53 | MatcherAssert.assertThat(((IgnoreLineEndingsGeneratedFileObjectMatcher) unit).expectedFileObject, Matchers.is(fo)); 54 | 55 | } 56 | 57 | @Test(expected = IllegalArgumentException.class) 58 | public void createIgnoreLineEndingsMatcher_nullValued() { 59 | 60 | CoreGeneratedFileObjectMatchers.createIgnoreLineEndingsMatcher(null); 61 | 62 | } 63 | 64 | @Test 65 | public void createBinaryMatcher() { 66 | 67 | FileObject fo = Mockito.mock(FileObject.class); 68 | GeneratedFileObjectMatcher unit = CoreGeneratedFileObjectMatchers.createBinaryMatcher(fo); 69 | MatcherAssert.assertThat(unit, Matchers.isA(BinaryGeneratedFileObjectMatcher.class)); 70 | MatcherAssert.assertThat(((BinaryGeneratedFileObjectMatcher) unit).expectedFileObject, Matchers.is(fo)); 71 | 72 | } 73 | 74 | @Test(expected = IllegalArgumentException.class) 75 | public void createBinaryMatcher_nullValued() { 76 | 77 | CoreGeneratedFileObjectMatchers.createBinaryMatcher(null); 78 | 79 | } 80 | } -------------------------------------------------------------------------------- /integration-test/junit4/src/test/java/io/toolisticon/cute/integrationtest/junit4/Junit4Test.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.junit4; 2 | 3 | 4 | import io.toolisticon.cute.Cute; 5 | import io.toolisticon.cute.UnitTestWithoutPassIn; 6 | import io.toolisticon.cute.extension.api.AssertionSpiServiceLocator; 7 | import io.toolisticon.cute.extension.junit4.JUnit4Assertion; 8 | import org.hamcrest.MatcherAssert; 9 | import org.hamcrest.Matchers; 10 | import org.junit.Assert; 11 | import org.junit.Test; 12 | 13 | import javax.annotation.processing.ProcessingEnvironment; 14 | import javax.tools.Diagnostic; 15 | 16 | /** 17 | * Test class to test junit 4 extension. 18 | */ 19 | public class Junit4Test { 20 | 21 | @Test 22 | public void testServiceLocator() { 23 | 24 | MatcherAssert.assertThat(AssertionSpiServiceLocator.locate().getClass(), Matchers.is((Class) JUnit4Assertion.class)); 25 | 26 | } 27 | 28 | @Test 29 | public void warningMessageTest() { 30 | 31 | Cute 32 | .unitTest() 33 | .when(new UnitTestWithoutPassIn() { 34 | @Override 35 | public void unitTest(ProcessingEnvironment processingEnvironment) { 36 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "WARNING!"); 37 | } 38 | }) 39 | .thenExpectThat() 40 | .compilationSucceeds() 41 | .andThat().compilerMessage().ofKindWarning().contains("WARNING!") 42 | .executeTest(); 43 | 44 | 45 | } 46 | 47 | @Test 48 | public void successfullFailingCompilationTest_ByErrorMessage() { 49 | 50 | Cute 51 | .unitTest() 52 | .when(new UnitTestWithoutPassIn() { 53 | @Override 54 | public void unitTest(ProcessingEnvironment processingEnvironment) { 55 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR, "ERROR!"); 56 | } 57 | }) 58 | .thenExpectThat() 59 | .compilationFails() 60 | .andThat().compilerMessage().ofKindError().contains("ERROR!") 61 | .executeTest(); 62 | 63 | 64 | } 65 | 66 | @Test 67 | public void failingCompilationTest_ByErrorMessage() { 68 | 69 | try { 70 | Cute 71 | .unitTest() 72 | .when(new UnitTestWithoutPassIn() { 73 | @Override 74 | public void unitTest(ProcessingEnvironment processingEnvironment) { 75 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR, "ERROR!"); 76 | } 77 | }) 78 | .thenExpectThat() 79 | .compilationSucceeds() 80 | .executeTest(); 81 | 82 | Assert.fail("Should have failed"); 83 | } catch (AssertionError error) { 84 | MatcherAssert.assertThat(error.getMessage(), Matchers.containsString("Compilation should have succeeded but failed")); 85 | } 86 | 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /integration-test/java9/test/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | integration-test-java9-test 5 | jar 6 | 7 | 8 | io.toolisticon.compiletesting 9 | integration-test-java9-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | integration-test-java9-test 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.compiletesting 20 | compiletesting 21 | 22 | 23 | 24 | junit 25 | junit 26 | test 27 | 28 | 29 | 30 | io.toolisticon.compiletesting 31 | integration-test-java9-regularModule 32 | ${project.version} 33 | 34 | 35 | 36 | io.toolisticon.compiletesting 37 | integration-test-java9-namedAutomaticModule 38 | ${project.version} 39 | 40 | 41 | 42 | io.toolisticon.compiletesting 43 | integration-test-java9-unnamedAutomaticModule 44 | ${project.version} 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | org.apache.maven.plugins 55 | maven-compiler-plugin 56 | 57 | 9 58 | 9 59 | 60 | 61 | 62 | 63 | 64 | org.codehaus.mojo 65 | animal-sniffer-maven-plugin 66 | ${animal-sniffer-maven-plugin.version} 67 | 68 | 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | org.apache.felix 77 | maven-bundle-plugin 78 | 79 | 80 | true 81 | 82 | 83 | 84 | 85 | 86 | 87 | maven-enforcer-plugin 88 | 89 | true 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /integration-test/testng/src/test/java/io/toolisticon/cute/integrationtest/testng/TestNgTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.testng; 2 | 3 | import io.toolisticon.cute.Cute; 4 | import io.toolisticon.cute.UnitTest; 5 | import io.toolisticon.cute.UnitTestWithoutPassIn; 6 | import io.toolisticon.cute.extension.api.AssertionSpiServiceLocator; 7 | import io.toolisticon.cute.extension.testng.TestNGAssertion; 8 | import org.hamcrest.MatcherAssert; 9 | import org.hamcrest.Matchers; 10 | import org.testng.Assert; 11 | import org.testng.annotations.Test; 12 | 13 | import javax.annotation.processing.ProcessingEnvironment; 14 | import javax.lang.model.element.Element; 15 | import javax.tools.Diagnostic; 16 | 17 | /** 18 | * Test class to test testng extension. 19 | */ 20 | public class TestNgTest { 21 | 22 | @Test 23 | public void testServiceLocator() { 24 | 25 | MatcherAssert.assertThat(AssertionSpiServiceLocator.locate().getClass(), Matchers.is((Class) TestNGAssertion.class)); 26 | 27 | } 28 | 29 | @Test 30 | public void warningMessageTest() { 31 | 32 | Cute 33 | .unitTest() 34 | .when(new UnitTestWithoutPassIn() { 35 | @Override 36 | public void unitTest(ProcessingEnvironment processingEnvironment) { 37 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "WARNING!"); 38 | } 39 | }) 40 | .thenExpectThat() 41 | .compilationSucceeds() 42 | .andThat().compilerMessage().ofKindWarning().contains("WARNING!") 43 | .executeTest(); 44 | 45 | 46 | } 47 | 48 | @Test 49 | public void successfullFailingCompilationTest_ByErrorMessage() { 50 | 51 | Cute 52 | .unitTest() 53 | .when(new UnitTestWithoutPassIn() { 54 | @Override 55 | public void unitTest(ProcessingEnvironment processingEnvironment) { 56 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR, "ERROR!"); 57 | } 58 | }) 59 | .thenExpectThat().compilationFails() 60 | .andThat().compilerMessage().ofKindError().contains("ERROR!") 61 | .executeTest(); 62 | 63 | 64 | } 65 | 66 | @Test 67 | public void failingCompilationTest_ByErrorMessage() { 68 | 69 | try { 70 | Cute 71 | .unitTest() 72 | .when(new UnitTestWithoutPassIn() { 73 | @Override 74 | public void unitTest(ProcessingEnvironment processingEnvironment) { 75 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR, "ERROR!"); 76 | } 77 | }) 78 | .thenExpectThat().compilationSucceeds() 79 | .executeTest(); 80 | 81 | Assert.fail("Should have failed"); 82 | } catch (AssertionError error) { 83 | MatcherAssert.assertThat(error.getMessage(), Matchers.containsString("Compilation should have succeeded but failed")); 84 | } 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /extension/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | extension-parent 5 | pom 6 | 7 | 8 | io.toolisticon.compiletesting 9 | compiletesting-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | extension-parent 14 | 15 | 16 | api 17 | plainjava 18 | junit4 19 | testng 20 | 21 | 22 | 23 | 24 | 25 | 26 | java-8 27 | 28 | [1.8,) 29 | 30 | 31 | 32 | junit5 33 | 34 | 35 | 36 | 37 | java-9 38 | 39 | [9,) 40 | 41 | 42 | 43 | modulesupport 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | maven-enforcer-plugin 57 | 58 | 59 | enforce 60 | 61 | enforce 62 | 63 | 64 | 65 | 66 | [3.0.0,) 67 | 68 | 69 | 1.6 70 | 71 | 72 | false 73 | 74 | * 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | org.apache.felix 85 | maven-bundle-plugin 86 | true 87 | 88 | 89 | io.toolisticon.compiletesting.extension 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /extension/api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | extension-api 5 | jar 6 | 7 | 8 | io.toolisticon.cute 9 | extension-parent 10 | 1.9.1-SNAPSHOT 11 | 12 | 13 | extension-api 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.spiap 20 | spiap-api 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | maven-compiler-plugin 32 | 33 | 34 | 35 | io.toolisticon.spiap 36 | spiap-processor 37 | ${spiap.version} 38 | 39 | 40 | io.toolisticon.spiap 41 | spiap-api 42 | ${spiap.version} 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | maven-enforcer-plugin 51 | 52 | 53 | enforce 54 | 55 | enforce 56 | 57 | 58 | 59 | 60 | [3.0.4,) 61 | 62 | 63 | 1.6 64 | 65 | 66 | false 67 | 68 | * 69 | 70 | 71 | io.toolisticon.cute:* 72 | io.toolisticon.spiap:provided 73 | io.toolisticon.spiap:spiap-api:compile 74 | *:*:*:*:test:* 75 | *:*:*:*:provided:* 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /extension/testng/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | extension-testng 5 | jar 6 | 7 | 8 | io.toolisticon.cute 9 | extension-parent 10 | 1.9.1-SNAPSHOT 11 | 12 | 13 | extension-testng 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.cute 20 | extension-api 21 | 22 | 23 | 24 | org.testng 25 | testng 26 | ${testng.version} 27 | provided 28 | 29 | 30 | 31 | io.toolisticon.spiap 32 | spiap-api 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | maven-compiler-plugin 44 | 45 | 46 | 47 | io.toolisticon.spiap 48 | spiap-processor 49 | ${spiap.version} 50 | 51 | 52 | io.toolisticon.spiap 53 | spiap-api 54 | ${spiap.version} 55 | 56 | 57 | 58 | 59 | 60 | 61 | maven-enforcer-plugin 62 | 63 | 64 | enforce 65 | 66 | enforce 67 | 68 | 69 | 70 | 71 | [3.0.4,) 72 | 73 | 74 | 1.6 75 | 76 | 77 | false 78 | 79 | * 80 | 81 | 82 | io.toolisticon.cute:extension-api:* 83 | io.toolisticon.spiap:provided 84 | *:*:*:*:test:* 85 | *:*:*:*:provided:* 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /extension/plainjava/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | extension-plainjava 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | extension-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | extension-plainjava 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | extension-api 22 | 23 | 24 | 25 | io.toolisticon.spiap 26 | spiap-api 27 | 28 | 29 | 30 | 31 | junit 32 | junit 33 | test 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | maven-compiler-plugin 45 | 46 | 47 | 48 | io.toolisticon.spiap 49 | spiap-processor 50 | ${spiap.version} 51 | 52 | 53 | io.toolisticon.spiap 54 | spiap-api 55 | ${spiap.version} 56 | 57 | 58 | 59 | 60 | 61 | 62 | maven-enforcer-plugin 63 | 64 | 65 | enforce 66 | 67 | enforce 68 | 69 | 70 | 71 | 72 | [3.0.4,) 73 | 74 | 75 | ${java.version} 76 | 77 | 78 | false 79 | 80 | * 81 | 82 | 83 | io.toolisticon.cute:extension-api:* 84 | io.toolisticon.spiap:provided 85 | *:*:*:*:test:* 86 | *:*:*:*:provided:* 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /coverage/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | coverage 6 | pom 7 | 8 | 9 | io.toolisticon.cute 10 | cute-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | coverage 15 | 16 | 17 | 18 | 19 | io.toolisticon.cute 20 | cute 21 | 22 | 23 | io.toolisticon.cute 24 | extension-api 25 | 26 | 27 | io.toolisticon.cute 28 | extension-junit4 29 | ${project.version} 30 | 31 | 32 | io.toolisticon.cute 33 | extension-testng 34 | ${project.version} 35 | 36 | 37 | io.toolisticon.cute 38 | integration-test-junit4 39 | ${project.version} 40 | 41 | 42 | io.toolisticon.cute 43 | integration-test-testng 44 | ${project.version} 45 | 46 | 52 | 53 | io.toolisticon.cute 54 | extension-plainjava 55 | 56 | 57 | 58 | 59 | 60 | 61 | use jdk8 sources 62 | 63 | [1.8,) 64 | 65 | 66 | 67 | io.toolisticon.cute 68 | extension-junit5 69 | ${project.version} 70 | 71 | 72 | io.toolisticon.cute 73 | integration-test-junit5 74 | ${project.version} 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | org.apache.maven.plugins 87 | maven-deploy-plugin 88 | 89 | true 90 | 91 | 92 | 93 | 94 | 95 | org.jacoco 96 | jacoco-maven-plugin 97 | 98 | 99 | report-aggregate 100 | verify 101 | 102 | report-aggregate 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /integration-test/java9/test/src/test/java/io/toolisticon/cute/integrationtest/java9/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute.integrationtest.java9; 2 | 3 | import io.toolisticon.cute.Cute; 4 | import io.toolisticon.cute.JavaFileObjectUtils; 5 | import io.toolisticon.cute.integrationtest.javanine.namednonmodule.NamedAutomaticModuleTestClass; 6 | import org.junit.Test; 7 | 8 | import javax.lang.model.element.TypeElement; 9 | import javax.tools.Diagnostic; 10 | 11 | /** 12 | * Java 9+ related integration tests. 13 | * Addresses mainly the jigsaw module system. 14 | */ 15 | public class IntegrationTest { 16 | 17 | @Test 18 | public void testBindRegularJavaModule() { 19 | 20 | Cute 21 | .blackBoxTest() 22 | .given().noProcessors() 23 | .andSourceFiles("/testcases/bindRegularJavaModule/Test.java", 24 | "/testcases/bindRegularJavaModule/module-info.java") 25 | .andUseModules("io.toolisticon.cute.integrationtest.javanine.regularmodule") 26 | .whenCompiled() 27 | .thenExpectThat().compilationSucceeds() 28 | .executeTest(); 29 | 30 | } 31 | 32 | 33 | @Test 34 | public void testBindRegularJavaModule_accessNotExportedClass() { 35 | 36 | Cute 37 | .blackBoxTest() 38 | .given() 39 | .noProcessors() 40 | .andSourceFiles("/testcases/accessNotExportedClass/Test.java","/testcases/accessNotExportedClass/module-info.java") 41 | .andUseModules("io.toolisticon.cute.integrationtest.javanine.regularmodule") 42 | .whenCompiled() 43 | .thenExpectThat() 44 | .compilationFails() 45 | .andThat().compilerMessage().ofKindError().contains("io.toolisticon.cute.integrationtest.javanine.regularmodule.notexported", "is not visible") 46 | .executeTest(); 47 | 48 | } 49 | 50 | @Test 51 | public void testBindNamedAutomaticJavaModule() { 52 | 53 | System.out.println("MODULE NAME: " + NamedAutomaticModuleTestClass.class.getModule().getName()); 54 | 55 | Cute 56 | .blackBoxTest() 57 | .given() 58 | .noProcessors() 59 | .andSourceFiles("/testcases/bindNamedAutomaticJavaModule/Test.java","/testcases/bindNamedAutomaticJavaModule/module-info.java") 60 | .andUseModules("integration.test.javanine.namedautomaticmodule") 61 | .whenCompiled() 62 | .thenExpectThat() 63 | .compilationSucceeds() 64 | .executeTest(); 65 | 66 | } 67 | 68 | @Test 69 | public void testBindUnnamedAutomaticJavaModule() { 70 | 71 | System.out.println("MODULE NAME: " + NamedAutomaticModuleTestClass.class.getModule().getName()); 72 | 73 | Cute 74 | .blackBoxTest() 75 | .given() 76 | .noProcessors() 77 | .andSourceFiles("/testcases/bindUnnamedAutomaticJavaModule/Test.java","/testcases/bindUnnamedAutomaticJavaModule/module-info.java") 78 | .andUseModules("integration.test.javanine.unnamedautomaticmodule") 79 | .whenCompiled() 80 | .thenExpectThat() 81 | .compilationSucceeds() 82 | .executeTest(); 83 | 84 | } 85 | 86 | @Test 87 | public void testUnitTestWithModules() { 88 | Cute.unitTest().given().useSourceFilesFromFolders("/testcases/unitTest") 89 | .when() 90 | .passInElement().fromGivenSourceFiles() 91 | .intoUnitTest( ((processingEnvironment, element) -> { 92 | processingEnvironment.getMessager().printMessage(Diagnostic.Kind.NOTE,"IT WORKED!!!"); 93 | })) 94 | .thenExpectThat().compilationSucceeds() 95 | .andThat().compilerMessage().ofKindNote().equals("IT WORKED!!!" ) 96 | .executeTest(); 97 | } 98 | 99 | 100 | } 101 | -------------------------------------------------------------------------------- /extension/junit5/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | extension-junit5 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | extension-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | extension-junit5 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | extension-api 22 | 23 | 24 | 25 | org.junit.jupiter 26 | junit-jupiter-api 27 | ${junit5.version} 28 | provided 29 | 30 | 31 | 32 | io.toolisticon.spiap 33 | spiap-api 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | maven-compiler-plugin 45 | 46 | 47 | 48 | io.toolisticon.spiap 49 | spiap-processor 50 | ${spiap.version} 51 | 52 | 53 | io.toolisticon.spiap 54 | spiap-api 55 | ${spiap.version} 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | maven-enforcer-plugin 64 | 65 | 66 | enforce 67 | 68 | enforce 69 | 70 | 71 | 72 | 73 | [3.0.4,) 74 | 75 | 76 | 1.6 77 | 78 | 79 | false 80 | 81 | * 82 | 83 | 84 | io.toolisticon.cute:extension-api:* 85 | io.toolisticon.spiap:provided 86 | *:*:*:*:test:* 87 | *:*:*:*:provided:* 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /extension/modulesupport/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | extension-modulesupport 5 | jar 6 | 7 | 8 | io.toolisticon.cute 9 | extension-parent 10 | 1.9.1-SNAPSHOT 11 | 12 | 13 | extension-modulesupport 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.cute 20 | extension-api 21 | 22 | 23 | 24 | io.toolisticon.spiap 25 | spiap-api 26 | 27 | 28 | 29 | junit 30 | junit 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | maven-compiler-plugin 42 | 43 | 9 44 | 9 45 | 46 | 47 | io.toolisticon.spiap 48 | spiap-processor 49 | ${spiap.version} 50 | 51 | 52 | 53 | 54 | 55 | 56 | maven-enforcer-plugin 57 | 58 | 59 | enforce 60 | 61 | enforce 62 | 63 | 64 | 65 | 66 | [3.0.4,) 67 | 68 | 69 | 9 70 | 71 | 72 | false 73 | 74 | * 75 | 76 | 77 | io.toolisticon.cute:extension-api:* 78 | io.toolisticon.spiap:provided 79 | *:*:*:*:test:* 80 | *:*:*:*:provided:* 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | org.codehaus.mojo 91 | animal-sniffer-maven-plugin 92 | ${animal-sniffer-maven-plugin.version} 93 | 94 | true 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /extension/junit4/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | extension-junit4 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | extension-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | extension-junit4 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | extension-api 22 | 23 | 24 | 25 | junit 26 | junit 27 | ${junit4.version} 28 | provided 29 | 30 | 31 | 32 | io.toolisticon.spiap 33 | spiap-api 34 | 35 | 36 | 37 | io.toolisticon.spiap 38 | spiap-processor 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | maven-compiler-plugin 49 | 50 | 51 | 52 | io.toolisticon.spiap 53 | spiap-processor 54 | ${spiap.version} 55 | 56 | 57 | io.toolisticon.spiap 58 | spiap-api 59 | ${spiap.version} 60 | 61 | 62 | 63 | 64 | 65 | maven-enforcer-plugin 66 | 67 | 68 | enforce 69 | 70 | enforce 71 | 72 | 73 | 74 | 75 | [3.0.4,) 76 | 77 | 78 | 1.6 79 | 80 | 81 | false 82 | 83 | * 84 | 85 | 86 | io.toolisticon.cute:extension-api:* 87 | io.toolisticon.spiap:provided 88 | *:*:*:*:test:* 89 | *:*:*:*:provided:* 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /legacy/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | cute-legacy 6 | jar 7 | 8 | 9 | io.toolisticon.cute 10 | cute-parent 11 | 1.9.1-SNAPSHOT 12 | 13 | 14 | cute-legacy 15 | 16 | 17 | 18 | 19 | 20 | io.toolisticon.cute 21 | cute 22 | 23 | 24 | 25 | io.toolisticon.fluapigen 26 | fluapigen-api 27 | 28 | 29 | 30 | 31 | junit 32 | junit 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | maven-compiler-plugin 44 | 45 | true 46 | 47 | 48 | io.toolisticon.fluapigen 49 | fluapigen-processor 50 | ${fluapigen.version} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | maven-enforcer-plugin 59 | 60 | 61 | enforce 62 | 63 | enforce 64 | 65 | 66 | 67 | 68 | [3.0.4,) 69 | 70 | 71 | 1.6 72 | 73 | 74 | false 75 | 76 | * 77 | 78 | 79 | io.toolisticon.cute:* 80 | io.toolisticon.fluapigen:* 81 | *:*:*:*:test:* 82 | *:*:*:*:provided:* 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | java-9 101 | 102 | [9,) 103 | 104 | 105 | 106 | 107 | io.toolisticon.cute 108 | extension-modulesupport 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /coverage/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | coverage 6 | pom 7 | 8 | 9 | io.toolisticon.cute 10 | cute-parent 11 | 0.12.1-SNAPSHOT 12 | 13 | 14 | coverage 15 | 16 | 17 | 18 | 19 | io.toolisticon.cute 20 | cute 21 | 22 | 23 | io.toolisticon.cute 24 | extension-api 25 | 26 | 27 | io.toolisticon.cute 28 | extension-junit4 29 | ${project.version} 30 | 31 | 32 | io.toolisticon.cute 33 | extension-junit4 34 | ${project.version} 35 | 36 | 37 | io.toolisticon.cute 38 | extension-testng 39 | ${project.version} 40 | 41 | 42 | io.toolisticon.cute 43 | integration-test-junit4 44 | ${project.version} 45 | 46 | 47 | io.toolisticon.cute 48 | integration-test-testng 49 | ${project.version} 50 | 51 | 57 | 58 | io.toolisticon.cute 59 | extension-plainjava 60 | 61 | 62 | 63 | 64 | 65 | 66 | use jdk8 sources 67 | 68 | [1.8,) 69 | 70 | 71 | 72 | io.toolisticon.cute 73 | extension-junit5 74 | ${project.version} 75 | 76 | 77 | io.toolisticon.cute 78 | integration-test-junit5 79 | ${project.version} 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | org.apache.maven.plugins 92 | maven-deploy-plugin 93 | 94 | true 95 | 96 | 97 | 98 | 99 | 100 | org.jacoco 101 | jacoco-maven-plugin 102 | 103 | 104 | report-aggregate 105 | verify 106 | 107 | report-aggregate 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /cute/src/test/java/io/toolisticon/cute/CompilerMessageCheckTest.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import io.toolisticon.cute.common.SimpleTestProcessor1; 4 | import org.junit.Test; 5 | 6 | import javax.lang.model.element.TypeElement; 7 | import javax.tools.Diagnostic; 8 | 9 | /** 10 | * Unit Test for checking correctness of compiler messages checks. 11 | */ 12 | public class CompilerMessageCheckTest { 13 | 14 | CuteApi.UnitTestRootInterface builder = Cute.unitTest(); 15 | 16 | @Test 17 | public void testComplexCompilerMessageCheck_findMessage_withAll() { 18 | 19 | builder.when() 20 | .passInElement().fromSourceFile("/AnnotationProcessorUnitTestTestClass.java") 21 | .intoUnitTest((processingEnvironment, element) -> processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "ABC", element)) 22 | .thenExpectThat().compilationSucceeds() 23 | .andThat().compilerMessage().ofKindWarning().atSource("/AnnotationProcessorUnitTestTestClass.java").atLine(13).atColumn(8).equals("ABC") 24 | .executeTest(); 25 | } 26 | 27 | @Test(expected = AssertionError.class) 28 | public void testComplexCompilerMessageCheck_dontFindMessage_withAll_wrongSource() { 29 | 30 | builder.when().passInElement().fromSourceFile("/AnnotationProcessorUnitTestTestClass.java") 31 | .intoUnitTest((processingEnvironment, element) -> processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "ABC", element)) 32 | .thenExpectThat().compilationSucceeds() 33 | .andThat().compilerMessage().ofKindWarning().atSource("/XYZ.java").atLine(15).atColumn(8).equals("ABC") 34 | .executeTest(); 35 | 36 | } 37 | 38 | @Test(expected = AssertionError.class) 39 | public void testComplexCompilerMessageCheck_dontFindMessage_withAll_wrongLine() { 40 | 41 | builder.when().passInElement().fromSourceFile("/AnnotationProcessorUnitTestClass.java") 42 | .intoUnitTest((processingEnvironment, element) -> processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "ABC", element)).thenExpectThat().compilationSucceeds() 43 | .andThat().compilerMessage().ofKindWarning().atSource("/AnnotationProcessorUnitTestClass.java").atLine(3).atColumn(8).equals("ABC") 44 | .executeTest(); 45 | 46 | } 47 | 48 | @Test(expected = AssertionError.class) 49 | public void testComplexCompilerMessageCheck_dontFindMessage_withAll_wrongColumn() { 50 | 51 | builder.when().passInElement().fromSourceFile("/AnnotationProcessorUnitTestClass.java") 52 | .intoUnitTest((processingEnvironment, element) -> processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "ABC", element)).thenExpectThat().compilationSucceeds() 53 | .andThat().compilerMessage().ofKindWarning().atSource("/AnnotationProcessorUnitTestClass.java").atLine(13).atColumn(7).equals("ABC") 54 | 55 | .executeTest(); 56 | 57 | } 58 | 59 | @Test(expected = AssertionError.class) 60 | public void testComplexCompilerMessageCheck_dontFindMessage_withAll_wrongMessage() { 61 | 62 | builder.when().passInElement().fromSourceFile("/AnnotationProcessorUnitTestClass.java") 63 | .intoUnitTest((processingEnvironment, element) -> processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "ABC", element)).thenExpectThat().compilationSucceeds() 64 | .andThat().compilerMessage().ofKindWarning().atSource("/AnnotationProcessorUnitTestClass.java").atLine(13).atColumn(8).equals("BC") 65 | 66 | .executeTest(); 67 | 68 | } 69 | 70 | @Test 71 | public void testComplexCompilerMessageCheck_findMessageSubstring_withAll() { 72 | 73 | builder.when().passInElement().fromSourceFile("/AnnotationProcessorUnitTestTestClass.java") 74 | .intoUnitTest((processingEnvironment, element) -> processingEnvironment.getMessager().printMessage(Diagnostic.Kind.WARNING, "ABC", element)).thenExpectThat().compilationSucceeds() 75 | .andThat().compilerMessage().ofKindWarning().atSource("/AnnotationProcessorUnitTestTestClass.java").atLine(13).atColumn(8).contains("BC") 76 | .executeTest(); 77 | 78 | } 79 | 80 | 81 | } 82 | -------------------------------------------------------------------------------- /cute/src/main/java/io/toolisticon/cute/AbstractUnitTestAnnotationProcessorWithPassIn.java: -------------------------------------------------------------------------------- 1 | package io.toolisticon.cute; 2 | 3 | import javax.lang.model.element.Element; 4 | import javax.lang.model.element.ElementKind; 5 | import javax.lang.model.element.ExecutableElement; 6 | import javax.lang.model.element.TypeElement; 7 | import java.lang.annotation.Annotation; 8 | import java.lang.reflect.InvocationTargetException; 9 | import java.lang.reflect.Method; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Abstract base class for unit tests with passed in elements. 15 | */ 16 | abstract class AbstractUnitTestAnnotationProcessorWithPassIn extends AbstractUnitTestAnnotationProcessorClass { 17 | 18 | 19 | /** 20 | * The type to scan for passed in element. 21 | */ 22 | protected final Class classToScan; 23 | 24 | /** 25 | * The annotation type to search for. 26 | */ 27 | private final Class annotationTypeUsedForScan; 28 | 29 | AbstractUnitTestAnnotationProcessorWithPassIn(Class annotationTypeToUse, Class classToScan, Class annotationTypeUsedForScan) { 30 | super(annotationTypeToUse); 31 | 32 | this.classToScan = classToScan; 33 | this.annotationTypeUsedForScan = annotationTypeUsedForScan; 34 | } 35 | 36 | /** 37 | * Gets the passed in element. 38 | * 39 | * @return the passed in element 40 | */ 41 | protected Element getPassedInElement() { 42 | 43 | TypeElement element = processingEnv.getElementUtils().getTypeElement(classToScan.getCanonicalName()); 44 | 45 | List allEnclosedElements = getAllSubElements(element); 46 | List filteredElements = filterByAnnotation(allEnclosedElements); 47 | 48 | if (filteredElements.size() != 1) { 49 | throw new FailingAssertionException(Constants.Messages.UNIT_TEST_PASS_IN_PRECONDITION_MUST_FIND_EXACTLY_ONE_ELEMENT.produceMessage(annotationTypeUsedForScan.getCanonicalName(), classToScan.getCanonicalName())); 50 | } 51 | 52 | return filteredElements.get(0); 53 | 54 | } 55 | 56 | 57 | /** 58 | * Creates a list of all enclosed elements of class 59 | * 60 | * @param elementToScan the element to scan 61 | * @return a list containing all sub-elements and the passed in element 62 | */ 63 | protected List getAllSubElements(Element elementToScan) { 64 | List result = new ArrayList<>(); 65 | 66 | if (elementToScan != null) { 67 | result.add(elementToScan); 68 | 69 | if (elementToScan.getKind() == ElementKind.CONSTRUCTOR || elementToScan.getKind() == ElementKind.METHOD) { 70 | result.addAll(((ExecutableElement) elementToScan).getParameters()); 71 | } 72 | 73 | // need to handle record components 74 | if (elementToScan.getKind().name() == "RECORD") { 75 | 76 | try { 77 | Method getRecordComponentsMethod = TypeElement.class.getMethod("getRecordComponents"); 78 | result.addAll((List)(getRecordComponentsMethod.invoke(elementToScan))); 79 | } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { 80 | // Java version < 16 - so just ignore since kind couldn't be of RECORD already - so this can't happen 81 | } 82 | 83 | } 84 | 85 | for (Element enclosedElement : elementToScan.getEnclosedElements()) { 86 | result.addAll(getAllSubElements(enclosedElement)); 87 | } 88 | 89 | } 90 | 91 | return result; 92 | } 93 | 94 | /** 95 | * Filters a list of elements by presence of annotationTypeUsedForScan. 96 | * 97 | * @param listToFilter the list to filter 98 | * @return a list containing all elements annotated with annotationTypeUsedForScan 99 | */ 100 | protected List filterByAnnotation(List listToFilter) { 101 | List result = new ArrayList<>(); 102 | 103 | for (Element element : listToFilter) { 104 | if (element.getAnnotation(annotationTypeUsedForScan) != null) { 105 | result.add(element); 106 | } 107 | } 108 | 109 | return result; 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /extension/api/pom.xml.releaseBackup: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | extension-api 5 | bundle 6 | 7 | 8 | io.toolisticon.compiletesting 9 | extension-parent 10 | 0.7.1-SNAPSHOT 11 | 12 | 13 | extension-api 14 | 15 | 16 | 17 | 18 | 19 | io.toolisticon.spiap 20 | spiap-api 21 | 22 | 23 | 24 | io.toolisticon.spiap 25 | spiap-processor 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.apache.felix 37 | maven-bundle-plugin 38 | true 39 | 40 | 41 | io.toolisticon.compiletesting.extension.api 42 | 43 | 44 | 45 | 46 | 47 | maven-enforcer-plugin 48 | 49 | 50 | enforce 51 | 52 | enforce 53 | 54 | 55 | 56 | 57 | [3.0.4,) 58 | 59 | 60 | 1.6 61 | 62 | 63 | false 64 | 65 | * 66 | 67 | 68 | io.toolisticon.compiletesting:* 69 | io.toolisticon.spiap:provided 70 | io.toolisticon.spiap:spiap-api:compile 71 | *:*:*:*:test:* 72 | *:*:*:*:provided:* 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | org.codehaus.mojo 83 | build-helper-maven-plugin 84 | 1.9.1 85 | 86 | 87 | add-resource 88 | generate-resources 89 | 90 | add-resource 91 | 92 | 93 | 94 | 95 | target/generated-sources/annotations 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | --------------------------------------------------------------------------------