diff --git a/annotationwrapper/api/pom.xml b/annotationwrapper/api/pom.xml
index 46d540eb..72c71559 100644
--- a/annotationwrapper/api/pom.xml
+++ b/annotationwrapper/api/pom.xml
@@ -8,7 +8,7 @@
io.toolisticon.aptk
aptk-annotationwrapper-parent
- 0.22.11
+ 0.23.0
aptk-annotationwrapper-api
diff --git a/annotationwrapper/integrationtest/pom.xml b/annotationwrapper/integrationtest/pom.xml
index ece7607e..4cb1fbba 100644
--- a/annotationwrapper/integrationtest/pom.xml
+++ b/annotationwrapper/integrationtest/pom.xml
@@ -9,7 +9,7 @@
io.toolisticon.aptk
aptk-annotationwrapper-parent
- 0.22.11
+ 0.23.0
aptk-annotationwrapper-integrationTest
@@ -112,6 +112,12 @@
cute
+
+ io.toolisticon.cute
+ cute-legacy
+
+
+
diff --git a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/TestAnnotation.java b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/ExampleTestAnnotation.java
similarity index 97%
rename from annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/TestAnnotation.java
rename to annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/ExampleTestAnnotation.java
index beb871c8..a4107280 100644
--- a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/TestAnnotation.java
+++ b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/ExampleTestAnnotation.java
@@ -9,7 +9,7 @@
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
-public @interface TestAnnotation {
+public @interface ExampleTestAnnotation {
// single value attributes
diff --git a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/AutoDetectedCustomCodeClass.java b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/AutoDetectedCustomCodeClass.java
index f2d6ff3f..5a437c55 100644
--- a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/AutoDetectedCustomCodeClass.java
+++ b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/AutoDetectedCustomCodeClass.java
@@ -1,12 +1,12 @@
package io.toolisticon.aptk.annotationwrapper.test.annotationonpackage;
import io.toolisticon.aptk.annotationwrapper.api.CustomCodeMethod;
-import io.toolisticon.aptk.annotationwrapper.test.TestAnnotation;
+import io.toolisticon.aptk.annotationwrapper.test.ExampleTestAnnotation;
public class AutoDetectedCustomCodeClass {
- @CustomCodeMethod(TestAnnotation.class)
- public static String autoDetectedMethod(TestAnnotationWrapper testAnnotationWrapper, String firstArg) {
+ @CustomCodeMethod(ExampleTestAnnotation.class)
+ public static String autoDetectedMethod(ExampleTestAnnotationWrapper testAnnotationWrapper, String firstArg) {
testAnnotationWrapper.enumAttribute();
return "it worked : " + firstArg;
}
diff --git a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/CustomCodeClass.java b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/CustomCodeClass.java
index 9812b786..5cbea632 100644
--- a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/CustomCodeClass.java
+++ b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/CustomCodeClass.java
@@ -1,18 +1,18 @@
package io.toolisticon.aptk.annotationwrapper.test.annotationonpackage;
import io.toolisticon.aptk.annotationwrapper.api.CustomCodeMethod;
-import io.toolisticon.aptk.annotationwrapper.test.TestAnnotation;
+import io.toolisticon.aptk.annotationwrapper.test.ExampleTestAnnotation;
public class CustomCodeClass {
- @CustomCodeMethod(TestAnnotation.class)
- public static String forwardedMethod(TestAnnotationWrapper testAnnotationWrapper, String firstArg) {
+ @CustomCodeMethod(ExampleTestAnnotation.class)
+ public static String forwardedMethod(ExampleTestAnnotationWrapper testAnnotationWrapper, String firstArg) {
testAnnotationWrapper.enumAttribute();
return "it worked : " + firstArg;
}
- @CustomCodeMethod(TestAnnotation.class)
- public static void forwardedMethodWithNoReturnValue(TestAnnotationWrapper testAnnotationWrapper, String firstArg) {
+ @CustomCodeMethod(ExampleTestAnnotation.class)
+ public static void forwardedMethodWithNoReturnValue(ExampleTestAnnotationWrapper testAnnotationWrapper, String firstArg) {
testAnnotationWrapper.enumAttribute();
}
diff --git a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/package-info.java b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/package-info.java
index cda324fa..f0887a0f 100644
--- a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/package-info.java
+++ b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/package-info.java
@@ -1,11 +1,11 @@
@AnnotationWrapper(
- value = {TestAnnotation.class, TestDefaultsAnnotation.class},
+ value = {ExampleTestAnnotation.class, TestDefaultsAnnotation.class},
bindCustomCode = {CustomCodeClass.class},
automaticallyWrapEmbeddedAnnotations = true)
package io.toolisticon.aptk.annotationwrapper.test.annotationonpackage;
import io.toolisticon.aptk.annotationwrapper.api.AnnotationWrapper;
-import io.toolisticon.aptk.annotationwrapper.test.TestAnnotation;
+import io.toolisticon.aptk.annotationwrapper.test.ExampleTestAnnotation;
import io.toolisticon.aptk.annotationwrapper.test.TestDefaultsAnnotation;
diff --git a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/AutoDetectedCustomCodeClass.java b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/AutoDetectedCustomCodeClass.java
index 497c5a20..52557817 100644
--- a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/AutoDetectedCustomCodeClass.java
+++ b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/AutoDetectedCustomCodeClass.java
@@ -1,12 +1,12 @@
package io.toolisticon.aptk.annotationwrapper.test.annotationontype;
import io.toolisticon.aptk.annotationwrapper.api.CustomCodeMethod;
-import io.toolisticon.aptk.annotationwrapper.test.TestAnnotation;
+import io.toolisticon.aptk.annotationwrapper.test.ExampleTestAnnotation;
public class AutoDetectedCustomCodeClass {
- @CustomCodeMethod(TestAnnotation.class)
- public static String autoDetectedMethod(TestAnnotationWrapper testAnnotationWrapper, String firstArg) {
+ @CustomCodeMethod(ExampleTestAnnotation.class)
+ public static String autoDetectedMethod(ExampleTestAnnotationWrapper testAnnotationWrapper, String firstArg) {
testAnnotationWrapper.enumAttribute();
return "it worked : " + firstArg;
}
diff --git a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/CustomCodeClass.java b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/CustomCodeClass.java
index c8a924a8..311a2f1b 100644
--- a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/CustomCodeClass.java
+++ b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/CustomCodeClass.java
@@ -1,18 +1,18 @@
package io.toolisticon.aptk.annotationwrapper.test.annotationontype;
import io.toolisticon.aptk.annotationwrapper.api.CustomCodeMethod;
-import io.toolisticon.aptk.annotationwrapper.test.TestAnnotation;
+import io.toolisticon.aptk.annotationwrapper.test.ExampleTestAnnotation;
public class CustomCodeClass {
- @CustomCodeMethod(TestAnnotation.class)
- public static String forwardedMethod(TestAnnotationWrapper testAnnotationWrapper, String firstArg) {
+ @CustomCodeMethod(ExampleTestAnnotation.class)
+ public static String forwardedMethod(ExampleTestAnnotationWrapper testAnnotationWrapper, String firstArg) {
testAnnotationWrapper.enumAttribute();
return "it worked : " + firstArg;
}
- @CustomCodeMethod(TestAnnotation.class)
- public static void forwardedMethodWithNoReturnValue(TestAnnotationWrapper testAnnotationWrapper, String firstArg) {
+ @CustomCodeMethod(ExampleTestAnnotation.class)
+ public static void forwardedMethodWithNoReturnValue(ExampleTestAnnotationWrapper testAnnotationWrapper, String firstArg) {
testAnnotationWrapper.enumAttribute();
}
diff --git a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/PackagePlaceholder.java b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/PackagePlaceholder.java
index f664d7ed..d54b6f36 100644
--- a/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/PackagePlaceholder.java
+++ b/annotationwrapper/integrationtest/src/main/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/PackagePlaceholder.java
@@ -1,12 +1,12 @@
package io.toolisticon.aptk.annotationwrapper.test.annotationontype;
import io.toolisticon.aptk.annotationwrapper.api.AnnotationWrapper;
-import io.toolisticon.aptk.annotationwrapper.test.TestAnnotation;
+import io.toolisticon.aptk.annotationwrapper.test.ExampleTestAnnotation;
import io.toolisticon.aptk.annotationwrapper.test.TestDefaultsAnnotation;
@AnnotationWrapper(
- value = {TestAnnotation.class, TestDefaultsAnnotation.class},
+ value = {ExampleTestAnnotation.class, TestDefaultsAnnotation.class},
bindCustomCode = {CustomCodeClass.class},
automaticallyWrapEmbeddedAnnotations = true)
diff --git a/annotationwrapper/integrationtest/src/test/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/IntegrationTest.java b/annotationwrapper/integrationtest/src/test/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/IntegrationTest.java
index 3c660612..42db0eb1 100644
--- a/annotationwrapper/integrationtest/src/test/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/IntegrationTest.java
+++ b/annotationwrapper/integrationtest/src/test/java/io/toolisticon/aptk/annotationwrapper/test/annotationonpackage/IntegrationTest.java
@@ -1,7 +1,7 @@
package io.toolisticon.aptk.annotationwrapper.test.annotationonpackage;
import io.toolisticon.aptk.annotationwrapper.test.EmbeddedAnnotation;
-import io.toolisticon.aptk.annotationwrapper.test.TestAnnotation;
+import io.toolisticon.aptk.annotationwrapper.test.ExampleTestAnnotation;
import io.toolisticon.aptk.annotationwrapper.test.TestDefaultsAnnotation;
import io.toolisticon.aptk.annotationwrapper.test.TestEnum;
import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
@@ -9,6 +9,7 @@
import io.toolisticon.aptk.tools.MessagerUtils;
import io.toolisticon.aptk.tools.TypeMirrorWrapper;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.PassIn;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
@@ -26,7 +27,7 @@
*/
public class IntegrationTest {
- CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder.unitTest();
+ CompileTestBuilderApi.UnitTestBuilder unitTestBuilder = CompileTestBuilder.unitTest();
@Before
public void init() {
@@ -34,17 +35,17 @@ public void init() {
}
@PassIn
- @TestAnnotation(
- stringAttribute = "WTF",
- doubleAttribute = 1.0,
- longAttribute = 1L,
- enumAttribute = TestEnum.TWO,
- typeAttribute = String.class,
- annotationAttribute = @EmbeddedAnnotation(1),
- stringArrayAttribute = {"1", "2", "3"},
- typeArrayAttribute = {Long.class, String.class},
- enumArrayAttribute = {TestEnum.TWO, TestEnum.THREE},
- annotationArrayAttribute = {@EmbeddedAnnotation(1), @EmbeddedAnnotation(2)}
+ @ExampleTestAnnotation(
+ stringAttribute = "WTF",
+ doubleAttribute = 1.0,
+ longAttribute = 1L,
+ enumAttribute = TestEnum.TWO,
+ typeAttribute = String.class,
+ annotationAttribute = @EmbeddedAnnotation(1),
+ stringArrayAttribute = {"1", "2", "3"},
+ typeArrayAttribute = {Long.class, String.class},
+ enumArrayAttribute = {TestEnum.TWO, TestEnum.THREE},
+ annotationArrayAttribute = {@EmbeddedAnnotation(1), @EmbeddedAnnotation(2)}
)
public static class TestUsage {
@@ -53,63 +54,63 @@ public static class TestUsage {
@Test
public void testWrappedAccess() {
unitTestBuilder.defineTestWithPassedInElement(TestUsage.class, new APTKUnitTestProcessor() {
- @Override
- public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
-
- TestAnnotationWrapper testAnnotationWrapper = TestAnnotationWrapper.wrap(typeElement);
-
- // check if element is returned correctly
- MatcherAssert.assertThat(testAnnotationWrapper._annotatedElement(), Matchers.is((Element) typeElement));
- MatcherAssert.assertThat(testAnnotationWrapper.annotationAttribute()._annotatedElement(), Matchers.is((Element) typeElement));
-
-
- // single attribute values
-
- MatcherAssert.assertThat(testAnnotationWrapper.charAttribute(), Matchers.is('X'));
- MatcherAssert.assertThat(testAnnotationWrapper.stringAttribute(), Matchers.is("WTF"));
- MatcherAssert.assertThat(testAnnotationWrapper.floatAttribute(), Matchers.is(0.0f));
- MatcherAssert.assertThat(testAnnotationWrapper.doubleAttribute(), Matchers.is(1.0));
- MatcherAssert.assertThat(testAnnotationWrapper.shortAttribute(), Matchers.is((short) 0));
- MatcherAssert.assertThat(testAnnotationWrapper.byteAttribute(), Matchers.is((byte) 0));
- MatcherAssert.assertThat(testAnnotationWrapper.intAttribute(), Matchers.is(0));
- MatcherAssert.assertThat(testAnnotationWrapper.longAttribute(), Matchers.is(1L));
- MatcherAssert.assertThat(testAnnotationWrapper.enumAttribute(), Matchers.is(TestEnum.TWO));
- MatcherAssert.assertThat(testAnnotationWrapper.typeAttributeAsFqn(), Matchers.is(String.class.getCanonicalName()));
- MatcherAssert.assertThat(testAnnotationWrapper.typeAttributeAsTypeMirror().toString(), Matchers.is(String.class.getCanonicalName()));
- MatcherAssert.assertThat(testAnnotationWrapper.typeAttributeAsTypeMirrorWrapper().getQualifiedName(), Matchers.is(String.class.getCanonicalName()));
- MatcherAssert.assertThat((Long) AnnotationUtils.getAnnotationValueOfAttributeWithDefaults(testAnnotationWrapper.annotationAttributeAsAnnotationMirror()).getValue(), Matchers.is(1L));
- MatcherAssert.assertThat(testAnnotationWrapper.annotationAttribute().value(), Matchers.is(1L));
-
- // array based attribute values
- MatcherAssert.assertThat(testAnnotationWrapper.charArrayAttribute().length, Matchers.is(0));
- MatcherAssert.assertThat(testAnnotationWrapper.stringArrayAttribute(), Matchers.arrayContaining("1", "2", "3"));
-
- MatcherAssert.assertThat(testAnnotationWrapper.intArrayAttribute().length, Matchers.is(0));
- MatcherAssert.assertThat(testAnnotationWrapper.longArrayAttribute().length, Matchers.is(0));
- MatcherAssert.assertThat(testAnnotationWrapper.shortArrayAttribute().length, Matchers.is(0));
- MatcherAssert.assertThat(testAnnotationWrapper.byteArrayAttribute().length, Matchers.is(0));
- MatcherAssert.assertThat(testAnnotationWrapper.floatArrayAttribute().length, Matchers.is(0));
- MatcherAssert.assertThat(testAnnotationWrapper.doubleArrayAttribute().length, Matchers.is(0));
- MatcherAssert.assertThat(testAnnotationWrapper.booleanArrayAttribute().length, Matchers.is(0));
-
- MatcherAssert.assertThat(testAnnotationWrapper.typeArrayAttributeAsFqn(), Matchers.arrayContaining(Long.class.getCanonicalName(), String.class.getCanonicalName()));
- TypeMirror[] typeMirrorArray = testAnnotationWrapper.typeArrayAttributeAsTypeMirror();
- MatcherAssert.assertThat(typeMirrorArray[0].toString(), Matchers.is(Long.class.getCanonicalName()));
- MatcherAssert.assertThat(typeMirrorArray[1].toString(), Matchers.is(String.class.getCanonicalName()));
- TypeMirrorWrapper[] typeMirrorWrapperArray = testAnnotationWrapper.typeArrayAttributeAsTypeMirrorWrapper();
- MatcherAssert.assertThat(typeMirrorWrapperArray[0].getQualifiedName(), Matchers.is(Long.class.getCanonicalName()));
- MatcherAssert.assertThat(typeMirrorWrapperArray[1].getQualifiedName(), Matchers.is(String.class.getCanonicalName()));
- MatcherAssert.assertThat(testAnnotationWrapper.enumArrayAttribute(), Matchers.arrayContaining(TestEnum.TWO, TestEnum.THREE));
- AnnotationMirror[] annotationMirrors = testAnnotationWrapper.annotationArrayAttributeAsAnnotationMirrorArray();
- MatcherAssert.assertThat((Long) AnnotationUtils.getAnnotationValueOfAttributeWithDefaults(annotationMirrors[0]).getValue(), Matchers.is(1L));
- MatcherAssert.assertThat((Long) AnnotationUtils.getAnnotationValueOfAttributeWithDefaults(annotationMirrors[1]).getValue(), Matchers.is(2L));
- EmbeddedAnnotationWrapper[] embeddedAnnotationWrappers = testAnnotationWrapper.annotationArrayAttribute();
- MatcherAssert.assertThat(embeddedAnnotationWrappers[0].value(), Matchers.is(1L));
- MatcherAssert.assertThat(embeddedAnnotationWrappers[1].value(), Matchers.is(2L));
- }
- })
- .compilationShouldSucceed()
- .executeTest();
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
+
+ ExampleTestAnnotationWrapper testAnnotationWrapper = ExampleTestAnnotationWrapper.wrap(typeElement);
+
+ // check if element is returned correctly
+ MatcherAssert.assertThat(testAnnotationWrapper._annotatedElement(), Matchers.is((Element) typeElement));
+ MatcherAssert.assertThat(testAnnotationWrapper.annotationAttribute()._annotatedElement(), Matchers.is((Element) typeElement));
+
+
+ // single attribute values
+
+ MatcherAssert.assertThat(testAnnotationWrapper.charAttribute(), Matchers.is('X'));
+ MatcherAssert.assertThat(testAnnotationWrapper.stringAttribute(), Matchers.is("WTF"));
+ MatcherAssert.assertThat(testAnnotationWrapper.floatAttribute(), Matchers.is(0.0f));
+ MatcherAssert.assertThat(testAnnotationWrapper.doubleAttribute(), Matchers.is(1.0));
+ MatcherAssert.assertThat(testAnnotationWrapper.shortAttribute(), Matchers.is((short) 0));
+ MatcherAssert.assertThat(testAnnotationWrapper.byteAttribute(), Matchers.is((byte) 0));
+ MatcherAssert.assertThat(testAnnotationWrapper.intAttribute(), Matchers.is(0));
+ MatcherAssert.assertThat(testAnnotationWrapper.longAttribute(), Matchers.is(1L));
+ MatcherAssert.assertThat(testAnnotationWrapper.enumAttribute(), Matchers.is(TestEnum.TWO));
+ MatcherAssert.assertThat(testAnnotationWrapper.typeAttributeAsFqn(), Matchers.is(String.class.getCanonicalName()));
+ MatcherAssert.assertThat(testAnnotationWrapper.typeAttributeAsTypeMirror().toString(), Matchers.is(String.class.getCanonicalName()));
+ MatcherAssert.assertThat(testAnnotationWrapper.typeAttributeAsTypeMirrorWrapper().getQualifiedName(), Matchers.is(String.class.getCanonicalName()));
+ MatcherAssert.assertThat((Long) AnnotationUtils.getAnnotationValueOfAttributeWithDefaults(testAnnotationWrapper.annotationAttributeAsAnnotationMirror()).getValue(), Matchers.is(1L));
+ MatcherAssert.assertThat(testAnnotationWrapper.annotationAttribute().value(), Matchers.is(1L));
+
+ // array based attribute values
+ MatcherAssert.assertThat(testAnnotationWrapper.charArrayAttribute().length, Matchers.is(0));
+ MatcherAssert.assertThat(testAnnotationWrapper.stringArrayAttribute(), Matchers.arrayContaining("1", "2", "3"));
+
+ MatcherAssert.assertThat(testAnnotationWrapper.intArrayAttribute().length, Matchers.is(0));
+ MatcherAssert.assertThat(testAnnotationWrapper.longArrayAttribute().length, Matchers.is(0));
+ MatcherAssert.assertThat(testAnnotationWrapper.shortArrayAttribute().length, Matchers.is(0));
+ MatcherAssert.assertThat(testAnnotationWrapper.byteArrayAttribute().length, Matchers.is(0));
+ MatcherAssert.assertThat(testAnnotationWrapper.floatArrayAttribute().length, Matchers.is(0));
+ MatcherAssert.assertThat(testAnnotationWrapper.doubleArrayAttribute().length, Matchers.is(0));
+ MatcherAssert.assertThat(testAnnotationWrapper.booleanArrayAttribute().length, Matchers.is(0));
+
+ MatcherAssert.assertThat(testAnnotationWrapper.typeArrayAttributeAsFqn(), Matchers.arrayContaining(Long.class.getCanonicalName(), String.class.getCanonicalName()));
+ TypeMirror[] typeMirrorArray = testAnnotationWrapper.typeArrayAttributeAsTypeMirror();
+ MatcherAssert.assertThat(typeMirrorArray[0].toString(), Matchers.is(Long.class.getCanonicalName()));
+ MatcherAssert.assertThat(typeMirrorArray[1].toString(), Matchers.is(String.class.getCanonicalName()));
+ TypeMirrorWrapper[] typeMirrorWrapperArray = testAnnotationWrapper.typeArrayAttributeAsTypeMirrorWrapper();
+ MatcherAssert.assertThat(typeMirrorWrapperArray[0].getQualifiedName(), Matchers.is(Long.class.getCanonicalName()));
+ MatcherAssert.assertThat(typeMirrorWrapperArray[1].getQualifiedName(), Matchers.is(String.class.getCanonicalName()));
+ MatcherAssert.assertThat(testAnnotationWrapper.enumArrayAttribute(), Matchers.arrayContaining(TestEnum.TWO, TestEnum.THREE));
+ AnnotationMirror[] annotationMirrors = testAnnotationWrapper.annotationArrayAttributeAsAnnotationMirrorArray();
+ MatcherAssert.assertThat((Long) AnnotationUtils.getAnnotationValueOfAttributeWithDefaults(annotationMirrors[0]).getValue(), Matchers.is(1L));
+ MatcherAssert.assertThat((Long) AnnotationUtils.getAnnotationValueOfAttributeWithDefaults(annotationMirrors[1]).getValue(), Matchers.is(2L));
+ EmbeddedAnnotationWrapper[] embeddedAnnotationWrappers = testAnnotationWrapper.annotationArrayAttribute();
+ MatcherAssert.assertThat(embeddedAnnotationWrappers[0].value(), Matchers.is(1L));
+ MatcherAssert.assertThat(embeddedAnnotationWrappers[1].value(), Matchers.is(2L));
+ }
+ })
+ .compilationShouldSucceed()
+ .executeTest();
}
@PassIn
@@ -123,14 +124,14 @@ public void testDefaultValueDetection() {
unitTestBuilder.defineTestWithPassedInElement(DefaultTestCase.class, new APTKUnitTestProcessor() {
@Override
public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
- // single attribute values
- TestDefaultsAnnotationWrapper wrappedAnnotation = TestDefaultsAnnotationWrapper.wrap(typeElement);
- MatcherAssert.assertThat(wrappedAnnotation.withDefaultIsDefaultValue(), Matchers.is(true));
- MatcherAssert.assertThat(wrappedAnnotation.withoutDefaultIsDefaultValue(), Matchers.is(false));
- }
- })
- .compilationShouldSucceed()
- .executeTest();
+ // single attribute values
+ TestDefaultsAnnotationWrapper wrappedAnnotation = TestDefaultsAnnotationWrapper.wrap(typeElement);
+ MatcherAssert.assertThat(wrappedAnnotation.withDefaultIsDefaultValue(), Matchers.is(true));
+ MatcherAssert.assertThat(wrappedAnnotation.withoutDefaultIsDefaultValue(), Matchers.is(false));
+ }
+ })
+ .compilationShouldSucceed()
+ .executeTest();
}
@Test
@@ -139,63 +140,63 @@ public void testCustomCodeForwarding() {
@Override
public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
- // single attribute values
- TestAnnotationWrapper wrappedAnnotation = TestAnnotationWrapper.wrap(typeElement);
- MatcherAssert.assertThat(wrappedAnnotation.forwardedMethod("yes"), Matchers.is("it worked : " + "yes"));
- wrappedAnnotation.forwardedMethodWithNoReturnValue("yes");
- wrappedAnnotation.autoDetectedMethod("yes");
+ // single attribute values
+ ExampleTestAnnotationWrapper wrappedAnnotation = ExampleTestAnnotationWrapper.wrap(typeElement);
+ MatcherAssert.assertThat(wrappedAnnotation.forwardedMethod("yes"), Matchers.is("it worked : " + "yes"));
+ wrappedAnnotation.forwardedMethodWithNoReturnValue("yes");
+ wrappedAnnotation.autoDetectedMethod("yes");
- }
- })
- .compilationShouldSucceed()
- .executeTest();
+ }
+ })
+ .compilationShouldSucceed()
+ .executeTest();
}
@Test
public void testCompilerMessageTriggeredByAnnotationWrapper() {
unitTestBuilder.defineTestWithPassedInElement(TestUsage.class, new APTKUnitTestProcessor() {
- @Override
- public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
-
- // single attribute values
- TestAnnotationWrapper wrappedAnnotation = TestAnnotationWrapper.wrap(typeElement);
- wrappedAnnotation.compilerMessage().asNote().write("NOTE");
- wrappedAnnotation.compilerMessage().asWarning().write("WARNING");
- wrappedAnnotation.compilerMessage().asMandatoryWarning().write("MWARNING");
- wrappedAnnotation.compilerMessage().asError().write("ERROR");
-
- }
- })
- .compilationShouldFail()
- .expectNoteMessage().thatIsEqualTo("NOTE")
- .expectWarningMessage().thatIsEqualTo("WARNING")
- .expectMandatoryWarningMessage().thatIsEqualTo("MWARNING")
- .expectErrorMessage().thatIsEqualTo("ERROR")
- .executeTest();
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
+
+ // single attribute values
+ ExampleTestAnnotationWrapper wrappedAnnotation = ExampleTestAnnotationWrapper.wrap(typeElement);
+ wrappedAnnotation.compilerMessage().asNote().write("NOTE");
+ wrappedAnnotation.compilerMessage().asWarning().write("WARNING");
+ wrappedAnnotation.compilerMessage().asMandatoryWarning().write("MWARNING");
+ wrappedAnnotation.compilerMessage().asError().write("ERROR");
+
+ }
+ })
+ .compilationShouldFail()
+ .expectNoteMessage().thatIsEqualTo("NOTE")
+ .expectWarningMessage().thatIsEqualTo("WARNING")
+ .expectMandatoryWarningMessage().thatIsEqualTo("MWARNING")
+ .expectErrorMessage().thatIsEqualTo("ERROR")
+ .executeTest();
}
@Test
public void testCompilerMessageTriggeredByAnnotationValueWrapper() {
unitTestBuilder.defineTestWithPassedInElement(TestUsage.class, new APTKUnitTestProcessor() {
- @Override
- public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
-
- // single attribute values
- TestAnnotationWrapper wrappedAnnotation = TestAnnotationWrapper.wrap(typeElement);
-
- wrappedAnnotation.annotationAttribute().compilerMessage().asNote().write("NOTE");
- wrappedAnnotation.annotationAttribute().compilerMessage().asWarning().write("WARNING");
- wrappedAnnotation.annotationAttribute().compilerMessage().asMandatoryWarning().write("MWARNING");
- wrappedAnnotation.annotationAttribute().compilerMessage().asError().write("ERROR");
-
- }
- })
- .compilationShouldFail()
- .expectNoteMessage().thatIsEqualTo("NOTE")
- .expectWarningMessage().thatIsEqualTo("WARNING")
- .expectMandatoryWarningMessage().thatIsEqualTo("MWARNING")
- .expectErrorMessage().thatIsEqualTo("ERROR")
- .executeTest();
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
+
+ // single attribute values
+ ExampleTestAnnotationWrapper wrappedAnnotation = ExampleTestAnnotationWrapper.wrap(typeElement);
+
+ wrappedAnnotation.annotationAttribute().compilerMessage().asNote().write("NOTE");
+ wrappedAnnotation.annotationAttribute().compilerMessage().asWarning().write("WARNING");
+ wrappedAnnotation.annotationAttribute().compilerMessage().asMandatoryWarning().write("MWARNING");
+ wrappedAnnotation.annotationAttribute().compilerMessage().asError().write("ERROR");
+
+ }
+ })
+ .compilationShouldFail()
+ .expectNoteMessage().thatIsEqualTo("NOTE")
+ .expectWarningMessage().thatIsEqualTo("WARNING")
+ .expectMandatoryWarningMessage().thatIsEqualTo("MWARNING")
+ .expectErrorMessage().thatIsEqualTo("ERROR")
+ .executeTest();
}
}
diff --git a/annotationwrapper/integrationtest/src/test/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/IntegrationTest.java b/annotationwrapper/integrationtest/src/test/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/IntegrationTest.java
index ec28bda0..162b6da9 100644
--- a/annotationwrapper/integrationtest/src/test/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/IntegrationTest.java
+++ b/annotationwrapper/integrationtest/src/test/java/io/toolisticon/aptk/annotationwrapper/test/annotationontype/IntegrationTest.java
@@ -1,15 +1,15 @@
package io.toolisticon.aptk.annotationwrapper.test.annotationontype;
import io.toolisticon.aptk.annotationwrapper.test.EmbeddedAnnotation;
-import io.toolisticon.aptk.annotationwrapper.test.TestAnnotation;
+import io.toolisticon.aptk.annotationwrapper.test.ExampleTestAnnotation;
import io.toolisticon.aptk.annotationwrapper.test.TestDefaultsAnnotation;
import io.toolisticon.aptk.annotationwrapper.test.TestEnum;
import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.aptk.tools.AnnotationUtils;
import io.toolisticon.aptk.tools.MessagerUtils;
import io.toolisticon.aptk.tools.TypeMirrorWrapper;
-import io.toolisticon.aptk.tools.wrapper.ElementWrapper;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.PassIn;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
@@ -27,7 +27,7 @@
*/
public class IntegrationTest {
- CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder.unitTest();
+ CompileTestBuilderApi.UnitTestBuilder unitTestBuilder = CompileTestBuilder.unitTest();
@Before
public void init() {
@@ -36,7 +36,7 @@ public void init() {
}
@PassIn
- @TestAnnotation(
+ @ExampleTestAnnotation(
stringAttribute = "WTF",
doubleAttribute = 1.0,
longAttribute = 1L,
@@ -58,7 +58,7 @@ public void testWrappedAccess() {
@Override
public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
- TestAnnotationWrapper testAnnotationWrapper = TestAnnotationWrapper.wrap(typeElement);
+ ExampleTestAnnotationWrapper testAnnotationWrapper = ExampleTestAnnotationWrapper.wrap(typeElement);
// check if element is returned correctly
MatcherAssert.assertThat(testAnnotationWrapper._annotatedElement(), Matchers.is((Element) typeElement));
@@ -145,7 +145,7 @@ public void testCustomCodeForwarding() {
public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
// single attribute values
- TestAnnotationWrapper wrappedAnnotation = TestAnnotationWrapper.wrap(typeElement);
+ ExampleTestAnnotationWrapper wrappedAnnotation = ExampleTestAnnotationWrapper.wrap(typeElement);
MatcherAssert.assertThat(wrappedAnnotation.forwardedMethod("yes"), Matchers.is("it worked : " + "yes"));
wrappedAnnotation.forwardedMethodWithNoReturnValue("yes");
wrappedAnnotation.autoDetectedMethod("yes");
diff --git a/annotationwrapper/pom.xml b/annotationwrapper/pom.xml
index 63ba01c6..fd0ef578 100644
--- a/annotationwrapper/pom.xml
+++ b/annotationwrapper/pom.xml
@@ -11,7 +11,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
diff --git a/annotationwrapper/processor/pom.xml b/annotationwrapper/processor/pom.xml
index 089682a3..b1a6e084 100644
--- a/annotationwrapper/processor/pom.xml
+++ b/annotationwrapper/processor/pom.xml
@@ -9,7 +9,7 @@
io.toolisticon.aptk
aptk-annotationwrapper-parent
- 0.22.11
+ 0.23.0
aptk-annotationwrapper-processor
@@ -40,6 +40,11 @@
cute
+
+ io.toolisticon.cute
+ cute-legacy
+
+
io.toolisticon.aptk
aptk-cute
diff --git a/annotationwrapper/processor/src/test/java/io/toolisticon/aptk/annotationwrapper/processor/AnnotationWrapperProcessorTest.java b/annotationwrapper/processor/src/test/java/io/toolisticon/aptk/annotationwrapper/processor/AnnotationWrapperProcessorTest.java
index dab6e071..a879db86 100644
--- a/annotationwrapper/processor/src/test/java/io/toolisticon/aptk/annotationwrapper/processor/AnnotationWrapperProcessorTest.java
+++ b/annotationwrapper/processor/src/test/java/io/toolisticon/aptk/annotationwrapper/processor/AnnotationWrapperProcessorTest.java
@@ -9,6 +9,7 @@
import io.toolisticon.aptk.tools.wrapper.ExecutableElementWrapper;
import io.toolisticon.cute.CompileTestBuilder;
import io.toolisticon.cute.PassIn;
+import io.toolisticon.cute.UnitTest;
import io.toolisticon.cute.matchers.CoreGeneratedFileObjectMatchers;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
@@ -450,7 +451,7 @@ private void test_AnnotationToWrap_getWrappedTypeMirror(TypeElement typeElement,
@Test
public void test_AnnotationToWrap_isAnnotationType() {
- CompileTestBuilder.unitTest().defineTestWithPassedInElement(UnitTestAnnotation.class, new APTKUnitTestProcessor() {
+ CompileTestBuilder.unitTest().defineTestWithPassedInElement(UnitTestAnnotation.class, new APTKUnitTestProcessor() {
@Override
public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
diff --git a/common/pom.xml b/common/pom.xml
index 22a8aa49..5f4f16d5 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -7,7 +7,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
aptk-common
diff --git a/compilermessages/api/pom.xml b/compilermessages/api/pom.xml
index 28203f7a..027b96c3 100644
--- a/compilermessages/api/pom.xml
+++ b/compilermessages/api/pom.xml
@@ -8,7 +8,7 @@
io.toolisticon.aptk
aptk-compilermessages-parent
- 0.22.11
+ 0.23.0
aptk-compilermessages-api
diff --git a/compilermessages/integrationtest/pom.xml b/compilermessages/integrationtest/pom.xml
index aa06ae8d..39e73b94 100644
--- a/compilermessages/integrationtest/pom.xml
+++ b/compilermessages/integrationtest/pom.xml
@@ -9,7 +9,7 @@
io.toolisticon.aptk
aptk-compilermessages-parent
- 0.22.11
+ 0.23.0
aptk-compilermessages-integrationTest
diff --git a/compilermessages/pom.xml b/compilermessages/pom.xml
index 86ab9364..f752e722 100644
--- a/compilermessages/pom.xml
+++ b/compilermessages/pom.xml
@@ -11,7 +11,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
diff --git a/compilermessages/processor/pom.xml b/compilermessages/processor/pom.xml
index 0f1b875f..81100cee 100644
--- a/compilermessages/processor/pom.xml
+++ b/compilermessages/processor/pom.xml
@@ -9,7 +9,7 @@
io.toolisticon.aptk
aptk-compilermessages-parent
- 0.22.11
+ 0.23.0
aptk-compilermessages-processor
diff --git a/cute/pom.xml b/cute/pom.xml
index d49d53b6..45a30b87 100644
--- a/cute/pom.xml
+++ b/cute/pom.xml
@@ -8,7 +8,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
aptk-cute
@@ -20,19 +20,13 @@
io.toolisticon.cute
cute
- provided
-
-
-
- io.toolisticon.aptk
- aptk-tools
+ ${cute.version}
provided
io.toolisticon.aptk
aptk-common
- provided
@@ -81,6 +75,7 @@
*
+ io.toolisticon.aptk:aptk-common:*:*
*:*:*:*:test:*
*:*:*:*:provided:*
diff --git a/cute/src/main/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorForTestingAnnotationProcessorsWithouPassIn.java b/cute/src/main/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorForTestingAnnotationProcessorsWithouPassIn.java
new file mode 100644
index 00000000..d6cdc4b1
--- /dev/null
+++ b/cute/src/main/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorForTestingAnnotationProcessorsWithouPassIn.java
@@ -0,0 +1,48 @@
+package io.toolisticon.aptk.cute;
+
+import io.toolisticon.aptk.common.ToolingProvider;
+import io.toolisticon.cute.UnitTestForTestingAnnotationProcessorsWithoutPassIn;
+
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.Processor;
+import javax.lang.model.element.Element;
+
+/**
+ * Convenient unit test processor for testing annotation processors build with the APTK with toolisticon's cute framework.
+ *
+ * @param The processor under test. init method will be called and {@link ToolingProvider} will be set.
+ */
+public abstract class APTKUnitTestProcessorForTestingAnnotationProcessorsWithouPassIn implements UnitTestForTestingAnnotationProcessorsWithoutPassIn {
+
+
+ /**
+ * The original unit test processor method. Contains logic to initialize the ToolingProvider.
+ * Will be called by cute framework. Propagates call to aptkUnitTest method after initializations.
+ *
+ * @param processor The processor under test
+ * @param processingEnvironment the processing environment
+ */
+ @Override
+ public final void unitTest(PROCESSOR processor, ProcessingEnvironment processingEnvironment) {
+
+ try {
+ // do initializations
+ ToolingProvider.setTooling(processingEnvironment);
+
+ // propagate to unit test implementation
+ this.aptkUnitTest(processor, processingEnvironment);
+
+ } finally {
+ ToolingProvider.clearTooling();
+ }
+
+ }
+
+ /**
+ * The unit test method.
+ *
+ * @param unit the initialized processor under test
+ * @param processingEnvironment the processingEnvironment
+ */
+ public abstract void aptkUnitTest(PROCESSOR unit, ProcessingEnvironment processingEnvironment);
+}
diff --git a/cute/src/main/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorWithoutPassIn.java b/cute/src/main/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorWithoutPassIn.java
new file mode 100644
index 00000000..6fa7ba78
--- /dev/null
+++ b/cute/src/main/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorWithoutPassIn.java
@@ -0,0 +1,38 @@
+package io.toolisticon.aptk.cute;
+
+import io.toolisticon.aptk.common.ToolingProvider;
+import io.toolisticon.cute.UnitTestWithoutPassIn;
+
+import javax.annotation.processing.ProcessingEnvironment;
+
+public abstract class APTKUnitTestProcessorWithoutPassIn implements UnitTestWithoutPassIn {
+
+ /**
+ * The original unit test processor method. Contains logic to initialize the ToolingProvider.
+ * Will be called by cute framework. Propagates call to aptkUnitTest method after initializations.
+ *
+ * @param processingEnvironment the processing environment
+ */
+ @Override
+ public final void unitTest(ProcessingEnvironment processingEnvironment) {
+
+ try {
+ // do initializations
+ ToolingProvider.setTooling(processingEnvironment);
+
+ // propagate to unit test implementation
+ this.aptkUnitTest(processingEnvironment);
+
+ } finally {
+ ToolingProvider.clearTooling();
+ }
+
+ }
+
+ /**
+ * The unit test method.
+ *
+ * @param processingEnvironment the processingEnvironment
+ */
+ public abstract void aptkUnitTest(ProcessingEnvironment processingEnvironment);
+}
\ No newline at end of file
diff --git a/cute/src/test/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorForTestingAnnotationProcessorsTest.java b/cute/src/test/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorForTestingAnnotationProcessorsTest.java
deleted file mode 100644
index d068e66c..00000000
--- a/cute/src/test/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorForTestingAnnotationProcessorsTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package io.toolisticon.aptk.cute;
-
-import io.toolisticon.aptk.tools.AbstractAnnotationProcessor;
-import io.toolisticon.aptk.common.ToolingProvider;
-import io.toolisticon.cute.CompileTestBuilder;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.RoundEnvironment;
-import javax.lang.model.element.TypeElement;
-import java.util.Set;
-
-/**
- * Unit test for {@link APTKUnitTestProcessorForTestingAnnotationProcessors}.
- */
-public class APTKUnitTestProcessorForTestingAnnotationProcessorsTest {
-
- private static boolean unitTestMethodCalled = false;
-
- public static class TestProcessor extends AbstractAnnotationProcessor {
-
- private static boolean initCalled = false;
-
-
- @Override
- public synchronized void init(ProcessingEnvironment processingEnv) {
- super.init(processingEnv);
-
- initCalled = true;
- }
-
- @Override
- public boolean processAnnotations(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
- return false;
- }
-
- }
-
- @Before
- public void init() {
- TestProcessor.initCalled = false;
- unitTestMethodCalled = false;
- }
-
- @Test
- public void testIfToolingIsSetCorrectly() {
-
- CompileTestBuilder.unitTest().defineTest(TestProcessor.class, new APTKUnitTestProcessorForTestingAnnotationProcessors() {
- @Override
- public void aptkUnitTest(TestProcessor processor, ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
-
- unitTestMethodCalled = true;
-
- MatcherAssert.assertThat(ToolingProvider.getTooling(), Matchers.notNullValue());
-
- }
- })
- .compilationShouldSucceed()
- .executeTest();
-
-
- // check if init was called
- MatcherAssert.assertThat("Init must have been called", TestProcessor.initCalled);
- MatcherAssert.assertThat("aptkUnitTest method must have been called", unitTestMethodCalled);
-
- }
-
-
-}
diff --git a/cute/src/test/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorTest.java b/cute/src/test/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorTest.java
deleted file mode 100644
index 52b243d2..00000000
--- a/cute/src/test/java/io/toolisticon/aptk/cute/APTKUnitTestProcessorTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.toolisticon.aptk.cute;
-
-import io.toolisticon.aptk.common.ToolingProvider;
-import io.toolisticon.cute.CompileTestBuilder;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.Test;
-
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.lang.model.element.TypeElement;
-
-/**
- * Unit test for {@link APTKUnitTestProcessor}.
- */
-public class APTKUnitTestProcessorTest {
-
- private static boolean unitTestMethodCalled = false;
-
-
-
- @Test
- public void testIfToolingIsSetCorrectly() {
-
- CompileTestBuilder.unitTest().defineTest( new APTKUnitTestProcessor() {
- @Override
- public void aptkUnitTest( ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
-
- unitTestMethodCalled = true;
-
- MatcherAssert.assertThat(ToolingProvider.getTooling(), Matchers.notNullValue());
-
- }
- })
- .compilationShouldSucceed()
- .executeTest();
-
-
- // check if init was called
- MatcherAssert.assertThat("aptkUnitTest method must have been called", unitTestMethodCalled);
-
- }
-
-
-}
diff --git a/example/example-annotationprocessor/pom.xml b/example/example-annotationprocessor/pom.xml
index dfc84407..9ffc4489 100644
--- a/example/example-annotationprocessor/pom.xml
+++ b/example/example-annotationprocessor/pom.xml
@@ -8,7 +8,7 @@
io.toolisticon.aptk
aptk-example-parent
- 0.22.11
+ 0.23.0
aptk-example-annotationprocessor
@@ -21,6 +21,8 @@
aptk-tools
+
+
io.toolisticon.aptk
aptk-example-annotations
@@ -32,6 +34,21 @@
spiap-api
+
+
+ io.toolisticon.cute
+ cute
+
+
+
+ io.toolisticon.cute
+ cute-legacy
+
+
+
+ io.toolisticon.aptk
+ aptk-cute
+
diff --git a/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/ImplementsSpecificInterfaceCheckAnnotationProcessorTest.java b/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/ImplementsSpecificInterfaceCheckAnnotationProcessorTest.java
index ac73819e..5550a351 100644
--- a/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/ImplementsSpecificInterfaceCheckAnnotationProcessorTest.java
+++ b/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/ImplementsSpecificInterfaceCheckAnnotationProcessorTest.java
@@ -3,6 +3,7 @@
import io.toolisticon.aptk.tools.MessagerUtils;
import io.toolisticon.aptk.tools.corematcher.CoreMatcherValidationMessages;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import org.junit.Before;
import org.junit.Test;
@@ -13,7 +14,7 @@
public class ImplementsSpecificInterfaceCheckAnnotationProcessorTest {
- private CompileTestBuilder.CompilationTestBuilder compilationTestBuilder = CompileTestBuilder.compilationTest()
+ private CompileTestBuilderApi.CompilationTestBuilder compilationTestBuilder = CompileTestBuilder.compilationTest()
.addProcessors(ImplementsSpecificInterfaceCheckAnnotationProcessor.class);
@Before
diff --git a/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/ImplementsSpecificInterfaceCheckAnnotationProcessorUnitTest.java b/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/ImplementsSpecificInterfaceCheckAnnotationProcessorUnitTest.java
index 11cd63b6..7ea24b3e 100644
--- a/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/ImplementsSpecificInterfaceCheckAnnotationProcessorUnitTest.java
+++ b/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/ImplementsSpecificInterfaceCheckAnnotationProcessorUnitTest.java
@@ -1,7 +1,7 @@
package io.toolisticon.aptk.example.annotationprocessor;
-import io.toolisticon.aptk.common.ToolingProvider;
+import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.cute.CompileTestBuilder;
import io.toolisticon.cute.UnitTest;
import org.hamcrest.MatcherAssert;
@@ -17,13 +17,13 @@ public class ImplementsSpecificInterfaceCheckAnnotationProcessorUnitTest {
public void testValidUsageWithAssignableParameters() {
CompileTestBuilder.unitTest()
- .defineTest(new UnitTest() {
- @Override
- public void unitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
+ .defineTest(new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
ImplementsSpecificInterfaceCheckAnnotationProcessor unit = new ImplementsSpecificInterfaceCheckAnnotationProcessor();
unit.init(processingEnvironment);
- ToolingProvider.setTooling(processingEnvironment);
+
MatcherAssert.assertThat("Should be assignable to Object", unit.isAssignableTo(typeElement, Object.class.getCanonicalName()));
@@ -38,13 +38,12 @@ public void unitTest(ProcessingEnvironment processingEnvironment, TypeElement ty
public void testValidUsageWithNonAssignableParameters() {
CompileTestBuilder.unitTest()
- .defineTest(new UnitTest() {
+ .defineTest(new APTKUnitTestProcessor() {
@Override
- public void unitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement typeElement) {
ImplementsSpecificInterfaceCheckAnnotationProcessor unit = new ImplementsSpecificInterfaceCheckAnnotationProcessor();
unit.init(processingEnvironment);
- ToolingProvider.setTooling(processingEnvironment);
MatcherAssert.assertThat("Should not be assignable to String", !unit.isAssignableTo(typeElement, String.class.getCanonicalName()));
diff --git a/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/MethodWithOneStringParameterAndVoidReturnTypeProcessorTest.java b/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/MethodWithOneStringParameterAndVoidReturnTypeProcessorTest.java
index 81a8208f..5fbfdb6e 100644
--- a/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/MethodWithOneStringParameterAndVoidReturnTypeProcessorTest.java
+++ b/example/example-annotationprocessor/src/test/java/io/toolisticon/aptk/example/annotationprocessor/MethodWithOneStringParameterAndVoidReturnTypeProcessorTest.java
@@ -3,6 +3,7 @@
import io.toolisticon.aptk.tools.MessagerUtils;
import io.toolisticon.aptk.tools.corematcher.CoreMatcherValidationMessages;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import org.junit.Before;
import org.junit.Test;
@@ -15,7 +16,7 @@ public void init() {
}
- private CompileTestBuilder.CompilationTestBuilder compilationTestBuilder = CompileTestBuilder.compilationTest()
+ private CompileTestBuilderApi.CompilationTestBuilder compilationTestBuilder = CompileTestBuilder.compilationTest()
.addProcessors(MethodHasStringParameterAndVoidReturnTypeCheckAnnotationProcessor.class);
@Test
diff --git a/example/example-annotations/pom.xml b/example/example-annotations/pom.xml
index 12f12ee4..dd72e543 100644
--- a/example/example-annotations/pom.xml
+++ b/example/example-annotations/pom.xml
@@ -7,7 +7,7 @@
io.toolisticon.aptk
aptk-example-parent
- 0.22.11
+ 0.23.0
aptk-example-annotations
diff --git a/example/example-usecase/pom.xml b/example/example-usecase/pom.xml
index 98b65c66..65a6d396 100644
--- a/example/example-usecase/pom.xml
+++ b/example/example-usecase/pom.xml
@@ -7,7 +7,7 @@
io.toolisticon.aptk
aptk-example-parent
- 0.22.11
+ 0.23.0
aptk-example-usecase
diff --git a/example/pom.xml b/example/pom.xml
index 8ac73f7d..b7a1f020 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -7,7 +7,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
aptk-example-parent
diff --git a/extensions/java9/pom.xml b/extensions/java9/pom.xml
index f14c686b..24ca55ba 100644
--- a/extensions/java9/pom.xml
+++ b/extensions/java9/pom.xml
@@ -8,7 +8,7 @@
io.toolisticon.aptk
extension-parent
- 0.22.11
+ 0.23.0
aptk-tools-java9
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 8b60529e..3219dd6c 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -7,7 +7,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
extension-parent
diff --git a/pom.xml b/pom.xml
index 1743c7ef..721c6896 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
pom
aptk-parent
@@ -87,7 +87,7 @@
0.11.0
- 0.12.1
+ 1.0.0_RC1
4.13.2
@@ -718,6 +718,11 @@
cute
+
+ io.toolisticon.cute
+ cute-legacy
+
+
@@ -742,6 +747,13 @@
${project.version}
+
+ io.toolisticon.aptk
+ aptk-cute
+ ${project.version}
+ test
+
+
io.toolisticon.aptk
aptk-annotationwrapper-api
@@ -769,6 +781,13 @@
test
+
+ io.toolisticon.cute
+ cute-legacy
+ ${cute.version}
+ test
+
+
diff --git a/templating/pom.xml b/templating/pom.xml
index fbe14fca..76a480ac 100644
--- a/templating/pom.xml
+++ b/templating/pom.xml
@@ -7,7 +7,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
aptk-templating
diff --git a/tools/pom.xml b/tools/pom.xml
index 2b5896aa..c028b0ba 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -8,7 +8,7 @@
io.toolisticon.aptk
aptk-parent
- 0.22.11
+ 0.23.0
aptk-tools
@@ -32,6 +32,18 @@
test
+
+ io.toolisticon.aptk
+ aptk-cute
+ ${project.version}
+
+
+
+ io.toolisticon.cute
+ cute-legacy
+ test
+
+
diff --git a/tools/src/main/java/io/toolisticon/aptk/tools/TypeMirrorWrapper.java b/tools/src/main/java/io/toolisticon/aptk/tools/TypeMirrorWrapper.java
index 76b4899e..89e93f88 100644
--- a/tools/src/main/java/io/toolisticon/aptk/tools/TypeMirrorWrapper.java
+++ b/tools/src/main/java/io/toolisticon/aptk/tools/TypeMirrorWrapper.java
@@ -241,6 +241,27 @@ public static boolean isCollection(TypeMirror typeMirror) {
}
+ /**
+ * Checks if wrapped TypeMirror represents an Iterable.
+ *
+ * @return true if wrapped TypeMirror represents an Iterable, otherwise false
+ */
+ public boolean isIterable() {
+ return isIterable(typeMirror);
+ }
+
+ /**
+ * Checks if passed TypeMirror represents an Iterable.
+ *
+ * @param typeMirror the TypeMirror to check
+ * @return true if passed TypeMirror represents an Iterable, otherwise false
+ */
+ public static boolean isIterable(TypeMirror typeMirror) {
+
+ return isDeclared(typeMirror) && TypeUtils.TypeComparison.isAssignableTo(TypeUtils.getTypes().erasure(typeMirror), TypeUtils.TypeRetrieval.getTypeMirror(Iterable.class));
+
+ }
+
/**
* Checks if wrapped TypeMirror is an array.
@@ -415,8 +436,8 @@ public static boolean hasComponentType(TypeMirror typeMirror) {
}
/**
- * Gets the ComponentType of TypeMirror representing an array or collection.
- * Will return TypeMirror of Object if collections component type isn't explicitly set.
+ * Gets the ComponentType of TypeMirror representing an array, a Collection or an Iterable.
+ * Will return TypeMirror of Object if Collections/Iterables component type isn't explicitly set.
*
* @return The component TypeMirror when passed typeMirror represents an array or collection, otherwise null.
*/
@@ -425,11 +446,11 @@ public TypeMirror getComponentType() {
}
/**
- * Gets the ComponentType of TypeMirror representing an array or collection.
- * Will return TypeMirror of Object if collections component type isn't explicitly set.
+ * Gets the ComponentType of TypeMirror representing an array, a Collection or an Iterable.
+ * Will return TypeMirror of Object if Collections/Iterablea component type isn't explicitly set.
*
* @param typeMirror the TypeMirror to check
- * @return The component TypeMirror when passed typeMirror represents an array a collection, otherwise null.
+ * @return The component TypeMirror when passed typeMirror represents an array, a Collection or Iterable, otherwise null.
*/
public static TypeMirror getComponentType(TypeMirror typeMirror) {
@@ -437,7 +458,7 @@ public static TypeMirror getComponentType(TypeMirror typeMirror) {
return ((ArrayType) typeMirror).getComponentType();
}
- if (isCollection(typeMirror)) {
+ if (isCollection(typeMirror) || isIterable(typeMirror)) {
if (hasTypeArguments(typeMirror)) {
List extends TypeMirror> typeArgumentTypeMirrors = getTypeArguments(typeMirror);
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/AbstractUnitTestAnnotationProcessorClass.java b/tools/src/test/java/io/toolisticon/aptk/tools/AbstractUnitTestAnnotationProcessorClass.java
index 5f6729cb..b28136b9 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/AbstractUnitTestAnnotationProcessorClass.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/AbstractUnitTestAnnotationProcessorClass.java
@@ -1,7 +1,7 @@
package io.toolisticon.aptk.tools;
import io.toolisticon.aptk.common.ToolingProvider;
-
+import io.toolisticon.cute.TestAnnotation;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/AnnotationUtilsTest.java b/tools/src/test/java/io/toolisticon/aptk/tools/AnnotationUtilsTest.java
index 16862f29..2b033ec4 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/AnnotationUtilsTest.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/AnnotationUtilsTest.java
@@ -1,5 +1,6 @@
package io.toolisticon.aptk.tools;
+import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.aptk.tools.annotationutilstestclasses.ClassArrayAttributeAnnotation;
import io.toolisticon.aptk.tools.annotationutilstestclasses.ClassAttributeAnnotation;
import io.toolisticon.aptk.tools.annotationutilstestclasses.DefaultValueAnnotation;
@@ -8,19 +9,20 @@
import io.toolisticon.aptk.tools.fluentfilter.FluentElementFilter;
import io.toolisticon.aptk.tools.wrapper.AnnotationMirrorWrapper;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.JavaFileObjectUtils;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
-import java.lang.annotation.Repeatable;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -33,7 +35,7 @@
*/
public class AnnotationUtilsTest {
- private CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder
+ private CompileTestBuilderApi.UnitTestBuilder unitTestBuilder = CompileTestBuilder
.unitTest()
.useSource(JavaFileObjectUtils.readFromResource("/AnnotationClassAttributeTestClass.java"));
@@ -50,26 +52,27 @@ public void init() {
@Test
public void annotationUtilsTest_classAttribute_emptyValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassAttributeAnnotation.class)
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassAttributeAnnotation.class)
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
+ .getResult();
- Element testElement = FluentElementFilter.createFluentElementFilter(result)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classAttribute_empty")
- .getResult().get(0);
+ Element testElement = FluentElementFilter.createFluentElementFilter(result)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classAttribute_empty")
+ .getResult().get(0);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(AnnotationUtils.getClassAttributeFromAnnotationAsFqn(testElement, ClassAttributeAnnotation.class), Matchers.nullValue());
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(AnnotationUtils.getClassAttributeFromAnnotationAsFqn(testElement, ClassAttributeAnnotation.class), Matchers.nullValue());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -78,26 +81,27 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_classAttribute_StringClassValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassAttributeAnnotation.class)
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassAttributeAnnotation.class)
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
+ .getResult();
- Element testElement = FluentElementFilter.createFluentElementFilter(result)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classAttribute_atDefaultValue")
- .getResult().get(0);
+ Element testElement = FluentElementFilter.createFluentElementFilter(result)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classAttribute_atDefaultValue")
+ .getResult().get(0);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(AnnotationUtils.getClassAttributeFromAnnotationAsFqn(testElement, ClassAttributeAnnotation.class), Matchers.equalTo(String.class.getCanonicalName()));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(AnnotationUtils.getClassAttributeFromAnnotationAsFqn(testElement, ClassAttributeAnnotation.class), Matchers.equalTo(String.class.getCanonicalName()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -106,26 +110,27 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_classAttributeWithExplicitAttributeName_LongClassValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassAttributeAnnotation.class)
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassAttributeAnnotation.class)
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
+ .getResult();
- Element testElement = FluentElementFilter.createFluentElementFilter(result)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classAttribute_atNamedAttribute")
- .getResult().get(0);
+ Element testElement = FluentElementFilter.createFluentElementFilter(result)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classAttribute_atNamedAttribute")
+ .getResult().get(0);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(AnnotationUtils.getClassAttributeFromAnnotationAsFqn(testElement, ClassAttributeAnnotation.class, "classAttribute"), Matchers.equalTo(Long.class.getCanonicalName()));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(AnnotationUtils.getClassAttributeFromAnnotationAsFqn(testElement, ClassAttributeAnnotation.class, "classAttribute"), Matchers.equalTo(Long.class.getCanonicalName()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -138,26 +143,27 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_arrayClassAttribute_emptyValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassArrayAttributeAnnotation.class)
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassArrayAttributeAnnotation.class)
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
+ .getResult();
- Element testElement = FluentElementFilter.createFluentElementFilter(result)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classArrayAttribute_empty")
- .getResult().get(0);
+ Element testElement = FluentElementFilter.createFluentElementFilter(result)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classArrayAttribute_empty")
+ .getResult().get(0);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(AnnotationUtils.getClassArrayAttributeFromAnnotationAsFqn(testElement, ClassArrayAttributeAnnotation.class), Matchers.arrayWithSize(0));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(AnnotationUtils.getClassArrayAttributeFromAnnotationAsFqn(testElement, ClassArrayAttributeAnnotation.class), Matchers.arrayWithSize(0));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -165,26 +171,27 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_arrayClassAttribute_StringDoubleFloatValues() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassArrayAttributeAnnotation.class)
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassArrayAttributeAnnotation.class)
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
+ .getResult();
- Element testElement = FluentElementFilter.createFluentElementFilter(result)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classArrayAttribute_atDefaultValue")
- .getResult().get(0);
+ Element testElement = FluentElementFilter.createFluentElementFilter(result)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classArrayAttribute_atDefaultValue")
+ .getResult().get(0);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(Arrays.asList(AnnotationUtils.getClassArrayAttributeFromAnnotationAsFqn(testElement, ClassArrayAttributeAnnotation.class)), Matchers.contains(String.class.getCanonicalName(), Double.class.getCanonicalName(), Float.class.getCanonicalName()));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(Arrays.asList(AnnotationUtils.getClassArrayAttributeFromAnnotationAsFqn(testElement, ClassArrayAttributeAnnotation.class)), Matchers.contains(String.class.getCanonicalName(), Double.class.getCanonicalName(), Float.class.getCanonicalName()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -193,26 +200,27 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_arrayClassAttributeWithExplicitAttributeName_LongIntegerValues() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassArrayAttributeAnnotation.class)
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassArrayAttributeAnnotation.class)
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
+ .getResult();
- Element testElement = FluentElementFilter.createFluentElementFilter(result)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classArrayAttribute_atNamedAttribute")
- .getResult().get(0);
+ Element testElement = FluentElementFilter.createFluentElementFilter(result)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classArrayAttribute_atNamedAttribute")
+ .getResult().get(0);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(Arrays.asList(AnnotationUtils.getClassArrayAttributeFromAnnotationAsFqn(testElement, ClassArrayAttributeAnnotation.class, "classArrayAttribute")), Matchers.contains(Long.class.getCanonicalName(), Integer.class.getCanonicalName()));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(Arrays.asList(AnnotationUtils.getClassArrayAttributeFromAnnotationAsFqn(testElement, ClassArrayAttributeAnnotation.class, "classArrayAttribute")), Matchers.contains(Long.class.getCanonicalName(), Integer.class.getCanonicalName()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -220,26 +228,27 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_arrayClassAttributeWithExplicitAttributeName_LongIntegerAnnotationClassAttributeTestClassValues() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassArrayAttributeAnnotation.class)
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(ClassArrayAttributeAnnotation.class)
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.METHOD)
+ .getResult();
- Element testElement = FluentElementFilter.createFluentElementFilter(result)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classArrayAttribute_atNamedAttribute_withUncompiledClass")
- .getResult().get(0);
+ Element testElement = FluentElementFilter.createFluentElementFilter(result)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("test_classArrayAttribute_atNamedAttribute_withUncompiledClass")
+ .getResult().get(0);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(Arrays.asList(AnnotationUtils.getClassArrayAttributeFromAnnotationAsFqn(testElement, ClassArrayAttributeAnnotation.class, "classArrayAttribute")), Matchers.contains(Long.class.getCanonicalName(), Integer.class.getCanonicalName(), "io.toolisticon.annotationprocessor.AnnotationClassAttributeTestClass"));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(Arrays.asList(AnnotationUtils.getClassArrayAttributeFromAnnotationAsFqn(testElement, ClassArrayAttributeAnnotation.class, "classArrayAttribute")), Matchers.contains(Long.class.getCanonicalName(), Integer.class.getCanonicalName(), "io.toolisticon.annotationprocessor.AnnotationClassAttributeTestClass"));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -253,22 +262,23 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_getAnnotationValueOfAttribute_getImplicitlySetAnnotationValueMustReturnNull() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
- MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
+ // precondition
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
+ MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
- // test
- AnnotationValue value = AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror);
+ // test
+ AnnotationValue value = AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(value, Matchers.nullValue());
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(value, Matchers.nullValue());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -281,22 +291,23 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_getAnnotationValueOfAttributeWithDefaults_getImplicitlySetAnnotationValue_defaultValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
- MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
+ // precondition
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
+ MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
- // test
- AnnotationValue value = AnnotationUtils.getAnnotationValueOfAttributeWithDefaults(annotationMirror);
+ // test
+ AnnotationValue value = AnnotationUtils.getAnnotationValueOfAttributeWithDefaults(annotationMirror);
- // shouldn't find nonexisting
- MatcherAssert.assertThat((Long) value.getValue(), Matchers.is(5L));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat((Long) value.getValue(), Matchers.is(5L));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -308,21 +319,22 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_getMandatoryAttributeValueNames_getMandatoryAttributeValueNames() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
- MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
+ // precondition
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
+ MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
- String[] names = AnnotationUtils.getMandatoryAttributeValueNames(annotationMirror);
+ String[] names = AnnotationUtils.getMandatoryAttributeValueNames(annotationMirror);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(Arrays.asList(names), Matchers.contains("mandatoryValue"));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(Arrays.asList(names), Matchers.contains("mandatoryValue"));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -335,22 +347,23 @@ protected void testCase(TypeElement element) {
@Test
public void annotationUtilsTest_getOptionalAttributeValueNames_getOptionalAttributeValueNames() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
- MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
+ // precondition
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
+ MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
- // test
- String[] names = AnnotationUtils.getOptionalAttributeValueNames(annotationMirror);
+ // test
+ String[] names = AnnotationUtils.getOptionalAttributeValueNames(annotationMirror);
- // shouldn't find nonexisting
- MatcherAssert.assertThat(Arrays.asList(names), Matchers.contains("value"));
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat(Arrays.asList(names), Matchers.contains("value"));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -362,22 +375,23 @@ protected void testCase(TypeElement element) {
@Test
public void getElementForAnnotationMirror_getElement() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
- MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
+ // precondition
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, DefaultValueAnnotation.class);
+ MatcherAssert.assertThat(annotationMirror, Matchers.notNullValue());
- // test
- TypeElement result = (TypeElement) AnnotationUtils.getElementForAnnotationMirror(annotationMirror);
+ // test
+ TypeElement result = (TypeElement) AnnotationUtils.getElementForAnnotationMirror(annotationMirror);
- MatcherAssert.assertThat(result, Matchers.notNullValue());
- MatcherAssert.assertThat(result.toString(), Matchers.is(DefaultValueAnnotation.class.getCanonicalName()));
+ MatcherAssert.assertThat(result, Matchers.notNullValue());
+ MatcherAssert.assertThat(result.toString(), Matchers.is(DefaultValueAnnotation.class.getCanonicalName()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -402,28 +416,29 @@ static class ClassAttributeTestcase_NonClassAttribute {
@Test
public void getClassAttributeFromAnnotationAsTypeMirror_shouldGetClassAttributeSuccefully() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(ClassAttributeTestcase_WithCorrectClassAttribute.class);
- MatcherAssert.assertThat("PRECONDITION : TypeElement must exist", typeElement, Matchers.notNullValue());
+ // precondition
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(ClassAttributeTestcase_WithCorrectClassAttribute.class);
+ MatcherAssert.assertThat("PRECONDITION : TypeElement must exist", typeElement, Matchers.notNullValue());
- // test - for value
- TypeMirror result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, ClassAttributeAnnotation.class);
+ // test - for value
+ TypeMirror result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, ClassAttributeAnnotation.class);
- MatcherAssert.assertThat(result, Matchers.notNullValue());
- MatcherAssert.assertThat("Type must match String : ", TypeUtils.TypeComparison.isTypeEqual(result, String.class));
+ MatcherAssert.assertThat(result, Matchers.notNullValue());
+ MatcherAssert.assertThat("Type must match String : ", TypeUtils.TypeComparison.isTypeEqual(result, String.class));
- // test - for value
- result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, ClassAttributeAnnotation.class, "classAttribute");
+ // test - for value
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, ClassAttributeAnnotation.class, "classAttribute");
- MatcherAssert.assertThat(result, Matchers.notNullValue());
- MatcherAssert.assertThat("Type must match Long : ", TypeUtils.TypeComparison.isTypeEqual(result, Long.class));
+ MatcherAssert.assertThat(result, Matchers.notNullValue());
+ MatcherAssert.assertThat("Type must match Long : ", TypeUtils.TypeComparison.isTypeEqual(result, Long.class));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -431,33 +446,34 @@ protected void testCase(TypeElement element) {
@Test
public void getClassAttributeFromAnnotationAsTypeMirror_shouldReturnNullForNonMatchingClassAttributes() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(ClassAttributeTestcase_WithCorrectClassAttribute.class);
- MatcherAssert.assertThat("PRECONDITION : TypeElement must exist", typeElement, Matchers.notNullValue());
+ // precondition
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(ClassAttributeTestcase_WithCorrectClassAttribute.class);
+ MatcherAssert.assertThat("PRECONDITION : TypeElement must exist", typeElement, Matchers.notNullValue());
- // test - no class based attribute
- TypeMirror result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, DefaultValueAnnotation.class);
- MatcherAssert.assertThat(result, Matchers.nullValue());
+ // test - no class based attribute
+ TypeMirror result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, DefaultValueAnnotation.class);
+ MatcherAssert.assertThat(result, Matchers.nullValue());
- // test - no class based attribute
- result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, DefaultValueAnnotation.class, "mandatoryValue");
- MatcherAssert.assertThat(result, Matchers.nullValue());
+ // test - no class based attribute
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, DefaultValueAnnotation.class, "mandatoryValue");
+ MatcherAssert.assertThat(result, Matchers.nullValue());
- // test - annotation not found
- result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, ClassArrayAttributeAnnotation.class);
- MatcherAssert.assertThat(result, Matchers.nullValue());
+ // test - annotation not found
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, ClassArrayAttributeAnnotation.class);
+ MatcherAssert.assertThat(result, Matchers.nullValue());
- // test - annotation doesn't take attributes
- result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, NoAttributeAnnotation.class);
- MatcherAssert.assertThat(result, Matchers.nullValue());
+ // test - annotation doesn't take attributes
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsTypeMirror(typeElement, NoAttributeAnnotation.class);
+ MatcherAssert.assertThat(result, Matchers.nullValue());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -466,39 +482,40 @@ protected void testCase(TypeElement element) {
@Test
public void getClassAttributeFromAnnotationAsFqn_shouldGetClassAttributeSuccefully() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(ClassAttributeTestcase_WithCorrectClassAttribute.class);
- MatcherAssert.assertThat("PRECONDITION : TypeElement must exist", typeElement, Matchers.notNullValue());
+ // precondition
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(ClassAttributeTestcase_WithCorrectClassAttribute.class);
+ MatcherAssert.assertThat("PRECONDITION : TypeElement must exist", typeElement, Matchers.notNullValue());
- // test - for value
- String result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, ClassAttributeAnnotation.class);
+ // test - for value
+ String result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, ClassAttributeAnnotation.class);
- MatcherAssert.assertThat(result, Matchers.notNullValue());
- MatcherAssert.assertThat("Type must match String : ", String.class.getCanonicalName().equals(result));
+ MatcherAssert.assertThat(result, Matchers.notNullValue());
+ MatcherAssert.assertThat("Type must match String : ", String.class.getCanonicalName().equals(result));
- // test - for value
- result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, ClassAttributeAnnotation.class, "classAttribute");
+ // test - for value
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, ClassAttributeAnnotation.class, "classAttribute");
- MatcherAssert.assertThat(result, Matchers.notNullValue());
- MatcherAssert.assertThat("Type must match Long : ", Long.class.getCanonicalName().equals(result));
+ MatcherAssert.assertThat(result, Matchers.notNullValue());
+ MatcherAssert.assertThat("Type must match Long : ", Long.class.getCanonicalName().equals(result));
- // test - for value
- result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(AnnotationUtils.getAnnotationMirror(typeElement, ClassAttributeAnnotation.class));
+ // test - for value
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(AnnotationUtils.getAnnotationMirror(typeElement, ClassAttributeAnnotation.class));
- MatcherAssert.assertThat(result, Matchers.notNullValue());
- MatcherAssert.assertThat("Type must match String : ", String.class.getCanonicalName().equals(result));
+ MatcherAssert.assertThat(result, Matchers.notNullValue());
+ MatcherAssert.assertThat("Type must match String : ", String.class.getCanonicalName().equals(result));
- // test - for value
- result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(AnnotationUtils.getAnnotationMirror(typeElement, ClassAttributeAnnotation.class), "classAttribute");
+ // test - for value
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(AnnotationUtils.getAnnotationMirror(typeElement, ClassAttributeAnnotation.class), "classAttribute");
- MatcherAssert.assertThat(result, Matchers.notNullValue());
- MatcherAssert.assertThat("Type must match Long : ", Long.class.getCanonicalName().equals(result));
- }
- })
+ MatcherAssert.assertThat(result, Matchers.notNullValue());
+ MatcherAssert.assertThat("Type must match Long : ", Long.class.getCanonicalName().equals(result));
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -506,33 +523,34 @@ protected void testCase(TypeElement element) {
@Test
public void getClassAttributeFromAnnotationAsFqn_shouldReturnNullForNonMatchingClassAttributes() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // precondition
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(ClassAttributeTestcase_WithCorrectClassAttribute.class);
- MatcherAssert.assertThat("PRECONDITION : TypeElement must exist", typeElement, Matchers.notNullValue());
+ // precondition
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(ClassAttributeTestcase_WithCorrectClassAttribute.class);
+ MatcherAssert.assertThat("PRECONDITION : TypeElement must exist", typeElement, Matchers.notNullValue());
- // test - no class based attribute
- String result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, DefaultValueAnnotation.class);
- MatcherAssert.assertThat(result, Matchers.nullValue());
+ // test - no class based attribute
+ String result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, DefaultValueAnnotation.class);
+ MatcherAssert.assertThat(result, Matchers.nullValue());
- // test - no class based attribute
- result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, DefaultValueAnnotation.class, "mandatoryValue");
- MatcherAssert.assertThat(result, Matchers.nullValue());
+ // test - no class based attribute
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, DefaultValueAnnotation.class, "mandatoryValue");
+ MatcherAssert.assertThat(result, Matchers.nullValue());
- // test - annotation not found
- result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, ClassArrayAttributeAnnotation.class);
- MatcherAssert.assertThat(result, Matchers.nullValue());
+ // test - annotation not found
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, ClassArrayAttributeAnnotation.class);
+ MatcherAssert.assertThat(result, Matchers.nullValue());
- // test - annotation doesn't take attributes
- result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, NoAttributeAnnotation.class);
- MatcherAssert.assertThat(result, Matchers.nullValue());
+ // test - annotation doesn't take attributes
+ result = AnnotationUtils.getClassAttributeFromAnnotationAsFqn(typeElement, NoAttributeAnnotation.class);
+ MatcherAssert.assertThat(result, Matchers.nullValue());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -541,23 +559,24 @@ protected void testCase(TypeElement element) {
// -- isRepeatableAnnotation
// --------------------------------------------
- public @interface NotRepeatable{
+ public @interface NotRepeatable {
}
@Test
public void isRepeatableAnnotation() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Should return true for Repeatable annotation", AnnotationUtils.isRepeatableAnnotation(IsRepeatable.class));
- MatcherAssert.assertThat("Should return false for non Repeatable annotation", !AnnotationUtils.isRepeatableAnnotation(NotRepeatable.class));
- MatcherAssert.assertThat("Should return false for null value", !AnnotationUtils.isRepeatableAnnotation(null));
+ MatcherAssert.assertThat("Should return true for Repeatable annotation", AnnotationUtils.isRepeatableAnnotation(IsRepeatable.class));
+ MatcherAssert.assertThat("Should return false for non Repeatable annotation", !AnnotationUtils.isRepeatableAnnotation(NotRepeatable.class));
+ MatcherAssert.assertThat("Should return false for null value", !AnnotationUtils.isRepeatableAnnotation(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -570,16 +589,17 @@ protected void testCase(TypeElement element) {
@Test
public void getRepeatableAnnotationWrapperClass() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat(AnnotationUtils.getRepeatableAnnotationWrapperClass(IsRepeatable.class).get(), Matchers.is(IsRepeatableWrapper.class));
- MatcherAssert.assertThat("Should return empty Optional for non Repeatable annotation", !AnnotationUtils.getRepeatableAnnotationWrapperClass(NotRepeatable.class).isPresent());
- MatcherAssert.assertThat("Should return empty Optional for null value", !AnnotationUtils.getRepeatableAnnotationWrapperClass(null).isPresent());
+ MatcherAssert.assertThat(AnnotationUtils.getRepeatableAnnotationWrapperClass(IsRepeatable.class).get(), Matchers.is(IsRepeatableWrapper.class));
+ MatcherAssert.assertThat("Should return empty Optional for non Repeatable annotation", !AnnotationUtils.getRepeatableAnnotationWrapperClass(NotRepeatable.class).isPresent());
+ MatcherAssert.assertThat("Should return empty Optional for null value", !AnnotationUtils.getRepeatableAnnotationWrapperClass(null).isPresent());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -589,26 +609,27 @@ protected void testCase(TypeElement element) {
// --------------------------------------------
-
@IsRepeatable("A")
@IsRepeatable("B")
- static class CompilerMessageAnchor{
+ static class CompilerMessageAnchor {
}
@Test
public void getRepeatableAnnotation() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(CompilerMessageAnchor.class);
- MatcherAssert.assertThat(AnnotationUtils.getRepeatableAnnotation(typeElement,IsRepeatable.class).get().stream().map(e -> AnnotationMirrorWrapper.wrap(e).getAttributeWithDefault().getStringValue()).collect(Collectors.toList()), Matchers.containsInAnyOrder("A", "B"));
- //MatcherAssert.assertThat("Should return empty Optional for non Repeatable annotation", !AnnotationUtils.getRepeatableAnnotationWrapperClass(NotRepeatable.class).isPresent());
- //MatcherAssert.assertThat("Should return empty Optional for null value", !AnnotationUtils.getRepeatableAnnotationWrapperClass(null).isPresent());
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(CompilerMessageAnchor.class);
+ MatcherAssert.assertThat(AnnotationUtils.getRepeatableAnnotation(typeElement, IsRepeatable.class).get().stream().map(e -> AnnotationMirrorWrapper.wrap(e).getAttributeWithDefault().getStringValue()).collect(Collectors.toList()), Matchers.containsInAnyOrder("A", "B"));
+ //MatcherAssert.assertThat("Should return empty Optional for non Repeatable annotation", !AnnotationUtils.getRepeatableAnnotationWrapperClass(NotRepeatable.class).isPresent());
+ //MatcherAssert.assertThat("Should return empty Optional for null value", !AnnotationUtils.getRepeatableAnnotationWrapperClass(null).isPresent());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/AnnotationValueUtilsTest.java b/tools/src/test/java/io/toolisticon/aptk/tools/AnnotationValueUtilsTest.java
index a25079ad..03dccf0b 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/AnnotationValueUtilsTest.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/AnnotationValueUtilsTest.java
@@ -1,13 +1,16 @@
package io.toolisticon.aptk.tools;
+import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.aptk.tools.annotationvalueutilstestclasses.AnnotationValueTestAnnotation;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.JavaFileObjectUtils;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.TypeElement;
@@ -25,7 +28,7 @@
*/
public class AnnotationValueUtilsTest {
- private CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder
+ private CompileTestBuilderApi.UnitTestBuilder unitTestBuilder = CompileTestBuilder
.unitTest()
.useSource(JavaFileObjectUtils.readFromResource("/AnnotationValueUtilsTestClass.java"));
@@ -42,36 +45,37 @@ public void init() {
@Test
public void annotationValueUtils_test_isLong() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isLong(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -79,36 +83,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isInteger() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isInteger(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -116,36 +122,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isFloat() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloat(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -153,36 +161,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isDouble() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDouble(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -190,36 +200,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isBoolean() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBoolean(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -227,36 +239,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isString() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isString(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -264,36 +278,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isChar() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isChar(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -301,35 +317,37 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isEnum() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnum(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -337,35 +355,37 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isClass() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClass(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -373,35 +393,37 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isAnnotation() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotation(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -409,36 +431,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isArray() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
-
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(true));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.is(false));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(true));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -451,36 +475,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getLongValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(1L));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.is(1L));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -489,36 +515,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getIntegerValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(1));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.is(1));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -526,35 +554,37 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getFloatValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(1.0f));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.is(1.0f));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -562,35 +592,37 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getDoubleValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(1.0));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.is(1.0));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -598,35 +630,37 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getBooleanValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -634,36 +668,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getStringValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is("stringValue"));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.is("stringValue"));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -671,35 +707,37 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getCharValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is('C'));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.is('C'));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -707,36 +745,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getEnumValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")).getSimpleName().toString(), Matchers.is(StandardLocation.SOURCE_OUTPUT.name()));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")).getSimpleName().toString(), Matchers.is(StandardLocation.SOURCE_OUTPUT.name()));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -744,36 +784,38 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getClassValue() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")).getSimpleName().toString(), Matchers.is(StandardLocation.SOURCE_OUTPUT.name()));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")).getSimpleName().toString(), Matchers.is(StandardLocation.SOURCE_OUTPUT.name()));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -781,35 +823,37 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getAnnotationValueOfAttribute() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")).toString(), Matchers.is("@" + Deprecated.class.getCanonicalName()));
-
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
-
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")).toString(), Matchers.is("@" + Deprecated.class.getCanonicalName()));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.nullValue());
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -818,51 +862,53 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getArrayValue_and_convertAndCastAttributeValueListToArray() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- // via convertAndCastAttributeValueListToArray
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Long.class)), Matchers.contains(1L, 2L, 3L));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Integer.class)), Matchers.contains(1, 2, 3));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Boolean.class)), Matchers.contains(true, false));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Float.class)), Matchers.contains(1.0f, 2.0f, 3.0f));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Double.class)), Matchers.contains(1.0, 2.0, 3.0));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), String.class)), Matchers.contains("1", "2"));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Character.class)), Matchers.contains('1', '2'));
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classValue")), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationValue")), Matchers.nullValue());
+ // via convertAndCastAttributeValueListToArray
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Long.class)), Matchers.contains(1L, 2L, 3L));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Integer.class)), Matchers.contains(1, 2, 3));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Boolean.class)), Matchers.contains(true, false));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Float.class)), Matchers.contains(1.0f, 2.0f, 3.0f));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Double.class)), Matchers.contains(1.0, 2.0, 3.0));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), String.class)), Matchers.contains("1", "2"));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Character.class)), Matchers.contains('1', '2'));
- TypeMirror[] typeMirrors = AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), TypeMirror.class);
- MatcherAssert.assertThat(typeMirrors.length, Matchers.is(2));
- MatcherAssert.assertThat(typeMirrors[0].toString(), Matchers.is(Long.class.getCanonicalName()));
- MatcherAssert.assertThat(typeMirrors[1].toString(), Matchers.is(Integer.class.getCanonicalName()));
+ TypeMirror[] typeMirrors = AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), TypeMirror.class);
+ MatcherAssert.assertThat(typeMirrors.length, Matchers.is(2));
+ MatcherAssert.assertThat(typeMirrors[0].toString(), Matchers.is(Long.class.getCanonicalName()));
+ MatcherAssert.assertThat(typeMirrors[1].toString(), Matchers.is(Integer.class.getCanonicalName()));
- VariableElement[] enums = AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), VariableElement.class);
- MatcherAssert.assertThat(enums.length, Matchers.is(2));
- MatcherAssert.assertThat(enums[0].toString(), Matchers.is(StandardLocation.SOURCE_OUTPUT.name()));
- MatcherAssert.assertThat(enums[1].toString(), Matchers.is(StandardLocation.CLASS_OUTPUT.name()));
+ VariableElement[] enums = AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), VariableElement.class);
+ MatcherAssert.assertThat(enums.length, Matchers.is(2));
+ MatcherAssert.assertThat(enums[0].toString(), Matchers.is(StandardLocation.SOURCE_OUTPUT.name()));
+ MatcherAssert.assertThat(enums[1].toString(), Matchers.is(StandardLocation.CLASS_OUTPUT.name()));
- AnnotationMirror[] annotationMirrors = AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), AnnotationMirror.class);
- MatcherAssert.assertThat(annotationMirrors.length, Matchers.is(1));
- MatcherAssert.assertThat(annotationMirrors[0].toString(), Matchers.is("@" + Deprecated.class.getCanonicalName()));
+ AnnotationMirror[] annotationMirrors = AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), AnnotationMirror.class);
+ MatcherAssert.assertThat(annotationMirrors.length, Matchers.is(1));
+ MatcherAssert.assertThat(annotationMirrors[0].toString(), Matchers.is("@" + Deprecated.class.getCanonicalName()));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -870,24 +916,26 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_convertAndCastAttributeValueListToArray_testNullSafety() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- MatcherAssert.assertThat(AnnotationValueUtils.convertAndCastAttributeValueListToArray(null, String.class), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.convertAndCastAttributeValueListToArray(null, String.class), Matchers.nullValue());
- boolean exceptionThrown = false;
- try {
- MatcherAssert.assertThat(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), null), Matchers.nullValue());
- } catch (IllegalArgumentException e) {
- exceptionThrown = true;
- }
- MatcherAssert.assertThat("Expected that IllegalArgumentException is thrown if passed type is null", exceptionThrown);
+ boolean exceptionThrown = false;
+ try {
+ MatcherAssert.assertThat(AnnotationValueUtils.convertAndCastAttributeValueListToArray(AnnotationValueUtils.getArrayValue(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), null), Matchers.nullValue());
+ } catch (IllegalArgumentException e) {
+ exceptionThrown = true;
+ }
+ MatcherAssert.assertThat("Expected that IllegalArgumentException is thrown if passed type is null", exceptionThrown);
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -895,39 +943,40 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getArrayValue_viaConvenienceMode() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
- // via convenience methods
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getLongValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue"))), Matchers.contains(1L, 2L, 3L));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getIntegerValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue"))), Matchers.contains(1, 2, 3));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getBooleanValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue"))), Matchers.contains(true, false));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getFloatValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue"))), Matchers.contains(1.0f, 2.0f, 3.0f));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getDoubleValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue"))), Matchers.contains(1.0, 2.0, 3.0));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getStringValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue"))), Matchers.contains("1", "2"));
- MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getCharValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue"))), Matchers.contains('1', '2'));
+ // via convenience methods
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getLongValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue"))), Matchers.contains(1L, 2L, 3L));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getIntegerValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue"))), Matchers.contains(1, 2, 3));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getBooleanValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue"))), Matchers.contains(true, false));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getFloatValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue"))), Matchers.contains(1.0f, 2.0f, 3.0f));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getDoubleValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue"))), Matchers.contains(1.0, 2.0, 3.0));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getStringValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue"))), Matchers.contains("1", "2"));
+ MatcherAssert.assertThat(Arrays.asList(AnnotationValueUtils.getCharValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue"))), Matchers.contains('1', '2'));
- TypeMirror[] typeMirrors = AnnotationValueUtils.getTypeAttributeValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue"));
- MatcherAssert.assertThat(typeMirrors.length, Matchers.is(2));
- MatcherAssert.assertThat(typeMirrors[0].toString(), Matchers.is(Long.class.getCanonicalName()));
- MatcherAssert.assertThat(typeMirrors[1].toString(), Matchers.is(Integer.class.getCanonicalName()));
+ TypeMirror[] typeMirrors = AnnotationValueUtils.getTypeAttributeValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue"));
+ MatcherAssert.assertThat(typeMirrors.length, Matchers.is(2));
+ MatcherAssert.assertThat(typeMirrors[0].toString(), Matchers.is(Long.class.getCanonicalName()));
+ MatcherAssert.assertThat(typeMirrors[1].toString(), Matchers.is(Integer.class.getCanonicalName()));
- VariableElement[] enums = AnnotationValueUtils.getEnumValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue"));
- MatcherAssert.assertThat(enums.length, Matchers.is(2));
- MatcherAssert.assertThat(enums[0].toString(), Matchers.is(StandardLocation.SOURCE_OUTPUT.name()));
- MatcherAssert.assertThat(enums[1].toString(), Matchers.is(StandardLocation.CLASS_OUTPUT.name()));
+ VariableElement[] enums = AnnotationValueUtils.getEnumValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue"));
+ MatcherAssert.assertThat(enums.length, Matchers.is(2));
+ MatcherAssert.assertThat(enums[0].toString(), Matchers.is(StandardLocation.SOURCE_OUTPUT.name()));
+ MatcherAssert.assertThat(enums[1].toString(), Matchers.is(StandardLocation.CLASS_OUTPUT.name()));
- AnnotationMirror[] annotationMirrors = AnnotationValueUtils.getAnnotationValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue"));
- MatcherAssert.assertThat(annotationMirrors.length, Matchers.is(1));
- MatcherAssert.assertThat(annotationMirrors[0].toString(), Matchers.is("@" + Deprecated.class.getCanonicalName()));
+ AnnotationMirror[] annotationMirrors = AnnotationValueUtils.getAnnotationValueArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue"));
+ MatcherAssert.assertThat(annotationMirrors.length, Matchers.is(1));
+ MatcherAssert.assertThat(annotationMirrors[0].toString(), Matchers.is("@" + Deprecated.class.getCanonicalName()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -935,34 +984,36 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_getArrayValue_viaConvenienceMode_testNullSafety() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- // test null safety
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
-
-
- MatcherAssert.assertThat(AnnotationValueUtils.getLongValueArray((AnnotationValue) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValueArray((AnnotationValue) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValueArray((AnnotationValue) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getFloatValueArray((AnnotationValue) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValueArray((AnnotationValue) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getStringValueArray((AnnotationValue) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getCharValueArray((AnnotationValue) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getEnumValueArray((AnnotationValue) null), Matchers.nullValue());
- MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue((AnnotationValue) null), Matchers.nullValue());
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ // test null safety
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValueArray((List extends AnnotationValue>) null), Matchers.nullValue());
+
+
+ MatcherAssert.assertThat(AnnotationValueUtils.getLongValueArray((AnnotationValue) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getIntegerValueArray((AnnotationValue) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getBooleanValueArray((AnnotationValue) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getFloatValueArray((AnnotationValue) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getDoubleValueArray((AnnotationValue) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getStringValueArray((AnnotationValue) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getCharValueArray((AnnotationValue) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getEnumValueArray((AnnotationValue) null), Matchers.nullValue());
+ MatcherAssert.assertThat(AnnotationValueUtils.getAnnotationValue((AnnotationValue) null), Matchers.nullValue());
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -970,48 +1021,50 @@ protected void testCase(TypeElement element) {
@Test
public void annotationValueUtils_test_isXXXAray() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
-
- MatcherAssert.assertThat(AnnotationValueUtils.isLongArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isIntegerArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isBooleanArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloatArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isDoubleArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isStringArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isCharArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnumArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isClassArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(true));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotationArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(true));
-
- MatcherAssert.assertThat(AnnotationValueUtils.isLongArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isIntegerArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBooleanArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloatArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDoubleArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isStringArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isCharArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnumArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClassArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotationArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
-
-
- MatcherAssert.assertThat(AnnotationValueUtils.isLongArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isIntegerArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isBooleanArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isFloatArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isDoubleArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isStringArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isCharArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isEnumArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isClassArray(null), Matchers.is(false));
- MatcherAssert.assertThat(AnnotationValueUtils.isAnnotationArray(null), Matchers.is(false));
-
-
- }
- })
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(element, AnnotationValueTestAnnotation.class);
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isLongArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "longArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isIntegerArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBooleanArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloatArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDoubleArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isStringArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isCharArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnumArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClassArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(true));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotationArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(true));
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isLongArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "intArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isIntegerArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "booleanArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBooleanArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloatArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "doubleArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDoubleArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "stringArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isStringArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "charArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isCharArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "enumArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnumArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "classArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClassArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "annotationArrayValue")), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotationArray(AnnotationUtils.getAnnotationValueOfAttribute(annotationMirror, "floatArrayValue")), Matchers.is(false));
+
+
+ MatcherAssert.assertThat(AnnotationValueUtils.isLongArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isIntegerArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isBooleanArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isFloatArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isDoubleArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isStringArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isCharArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isEnumArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isClassArray(null), Matchers.is(false));
+ MatcherAssert.assertThat(AnnotationValueUtils.isAnnotationArray(null), Matchers.is(false));
+
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/BeanUtilsTest.java b/tools/src/test/java/io/toolisticon/aptk/tools/BeanUtilsTest.java
index 1e2b98b1..e5300485 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/BeanUtilsTest.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/BeanUtilsTest.java
@@ -1,15 +1,18 @@
package io.toolisticon.aptk.tools;
import com.sun.source.tree.StatementTree;
+import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.aptk.tools.corematcher.AptkCoreMatchers;
import io.toolisticon.aptk.tools.fluentfilter.FluentElementFilter;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.JavaFileObjectUtils;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
@@ -23,7 +26,7 @@
*/
public class BeanUtilsTest {
- private CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder
+ private CompileTestBuilderApi.UnitTestBuilder unitTestBuilder = CompileTestBuilder
.unitTest()
.useSource(JavaFileObjectUtils.readFromResource("/AnnotationValueUtilsTestClass.java"));
@@ -36,13 +39,15 @@ public void init() {
@Test
public void getPossibleGetterOrSetterNames_getter() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- MatcherAssert.assertThat(Arrays.asList(BeanUtils.getPrefixedName("get", "testField")), Matchers.contains("getTestField"));
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- }
- })
+ MatcherAssert.assertThat(Arrays.asList(BeanUtils.getPrefixedName("get", "testField")), Matchers.contains("getTestField"));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -56,19 +61,21 @@ protected void testCase(TypeElement element) {
public void fieldWithImplementedGetterAndSetters_checkHasGetter() {
unitTestBuilder.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/FieldLevelTestcases.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_FIELD)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithImplementedGetterAndSetters")
- .getResult().get(0);
-
-
- // shouldn't find nonexisting
- MatcherAssert.assertThat("Should detect getter ", BeanUtils.checkHasGetter(field));
- }
- })
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_FIELD)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithImplementedGetterAndSetters")
+ .getResult().get(0);
+
+
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat("Should detect getter ", BeanUtils.checkHasGetter(field));
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -78,44 +85,45 @@ protected void testCase(TypeElement element) {
public void fieldWithImplementedGetterAndSetters_checkHasSetter() {
unitTestBuilder.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/FieldLevelTestcases.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_FIELD)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithImplementedGetterAndSetters")
- .getResult().get(0);
-
-
- // shouldn't find nonexisting
- MatcherAssert.assertThat("Should detect setter ", BeanUtils.checkHasSetter(field));
- }
- })
- .compilationShouldSucceed()
- .executeTest();
- }
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_FIELD)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithImplementedGetterAndSetters")
+ .getResult().get(0);
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat("Should detect setter ", BeanUtils.checkHasSetter(field));
+ }
+ })
+ .compilationShouldSucceed()
+ .executeTest();
+ }
@Test
public void fieldWithoutGetter_checkHasGetter() {
unitTestBuilder.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/FieldLevelTestcases.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_FIELD)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithoutGetter")
- .getResult().get(0);
-
-
- // shouldn't find nonexisting
- MatcherAssert.assertThat("Should not detect getter ", !BeanUtils.checkHasGetter(field));
- }
- })
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_FIELD)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithoutGetter")
+ .getResult().get(0);
+
+
+ // shouldn't find nonexisting
+ MatcherAssert.assertThat("Should not detect getter ", !BeanUtils.checkHasGetter(field));
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -124,24 +132,23 @@ protected void testCase(TypeElement element) {
public void fieldWithoutSetter_checkHasSetter() {
unitTestBuilder.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/FieldLevelTestcases.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_FIELD)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithoutSetter")
- .getResult().get(0);
-
-
- MatcherAssert.assertThat("Should not detect setter ", !BeanUtils.checkHasSetter(field));
- }
- })
- .compilationShouldSucceed()
- .executeTest();
- }
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_FIELD)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithoutSetter")
+ .getResult().get(0);
+ MatcherAssert.assertThat("Should not detect setter ", !BeanUtils.checkHasSetter(field));
+ }
+ })
+ .compilationShouldSucceed()
+ .executeTest();
+ }
// -----------------------
@@ -153,18 +160,20 @@ public void isAttribute_fieldWithBothGetterAndSetter() {
unitTestBuilder
.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/FieldLevelTestcases.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_FIELD)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithImplementedGetterAndSetters")
- .getResult().get(0);
-
-
- MatcherAssert.assertThat("Must return true for field with getter and setter", BeanUtils.isAttribute(field));
- }
- })
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_FIELD)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithImplementedGetterAndSetters")
+ .getResult().get(0);
+
+
+ MatcherAssert.assertThat("Must return true for field with getter and setter", BeanUtils.isAttribute(field));
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -174,18 +183,20 @@ public void isAttribute_fieldWithoutSetter() {
unitTestBuilder
.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/FieldLevelTestcases.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_FIELD)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithoutGetter")
- .getResult().get(0);
-
-
- MatcherAssert.assertThat("Must return true for field without setter", !BeanUtils.isAttribute(field));
- }
- })
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_FIELD)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithoutGetter")
+ .getResult().get(0);
+
+
+ MatcherAssert.assertThat("Must return true for field without setter", !BeanUtils.isAttribute(field));
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -195,18 +206,20 @@ public void isAttribute_fieldWithoutGetter() {
unitTestBuilder
.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/FieldLevelTestcases.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_FIELD)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithoutSetter")
- .getResult().get(0);
-
-
- MatcherAssert.assertThat("Must return true for field without getter", !BeanUtils.isAttribute(field));
- }
- })
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ VariableElement field = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_FIELD)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("fieldWithoutSetter")
+ .getResult().get(0);
+
+
+ MatcherAssert.assertThat("Must return true for field without getter", !BeanUtils.isAttribute(field));
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -221,26 +234,28 @@ public void getAttributes_withTypeHierarchy1() {
unitTestBuilder
.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/TypeHierarchyTestClass.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- TypeElement typeElement = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_CLASS)
- .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf(".*InheritingType")
- .getResult().get(0);
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ TypeElement typeElement = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_CLASS)
+ .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf(".*InheritingType")
+ .getResult().get(0);
- BeanUtils.AttributeResult[] results = BeanUtils.getAttributes(typeElement);
+ BeanUtils.AttributeResult[] results = BeanUtils.getAttributes(typeElement);
- Set attributeNames = new HashSet();
+ Set attributeNames = new HashSet();
- for (BeanUtils.AttributeResult result : results) {
- attributeNames.add(result.getFieldName());
- }
+ for (BeanUtils.AttributeResult result : results) {
+ attributeNames.add(result.getFieldName());
+ }
- MatcherAssert.assertThat(attributeNames, Matchers.contains("booleanField", "stringField"));
- }
- })
+ MatcherAssert.assertThat(attributeNames, Matchers.contains("booleanField", "stringField"));
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -250,27 +265,29 @@ public void getAttributes_withTypeHierarchy2() {
unitTestBuilder
.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/TypeHierarchyTestClass.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- TypeElement typeElement = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_CLASS)
- .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf(".*InheritingType")
- .getResult().get(0);
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ TypeElement typeElement = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_CLASS)
+ .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf(".*InheritingType")
+ .getResult().get(0);
- BeanUtils.AttributeResult[] results = BeanUtils.getAttributesWithInheritance(typeElement);
- Set attributeNames = new HashSet();
+ BeanUtils.AttributeResult[] results = BeanUtils.getAttributesWithInheritance(typeElement);
- for (BeanUtils.AttributeResult result : results) {
- attributeNames.add(result.getFieldName());
- }
+ Set attributeNames = new HashSet();
- MatcherAssert.assertThat(attributeNames, Matchers.containsInAnyOrder("booleanField", "stringField", "superBooleanField", "superStringField"));
+ for (BeanUtils.AttributeResult result : results) {
+ attributeNames.add(result.getFieldName());
+ }
- }
- })
+ MatcherAssert.assertThat(attributeNames, Matchers.containsInAnyOrder("booleanField", "stringField", "superBooleanField", "superStringField"));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -285,19 +302,21 @@ public void isDefaultNoargConstructor_defaultNoargConstructor() {
unitTestBuilder
.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/DefaultNoargConstructorTest.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- ExecutableElement constructor = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_CONSTRUCTOR)
- .getResult().get(0);
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ ExecutableElement constructor = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_CONSTRUCTOR)
+ .getResult().get(0);
- MatcherAssert.assertThat("Should return true for default constructor", BeanUtils.isDefaultNoargConstructor(constructor));
- MatcherAssert.assertThat("Should return true for default constructor", BeanUtils.hasDefaultNoargsConstructor(element));
+ MatcherAssert.assertThat("Should return true for default constructor", BeanUtils.isDefaultNoargConstructor(constructor));
+ MatcherAssert.assertThat("Should return true for default constructor", BeanUtils.hasDefaultNoargsConstructor(element));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -307,19 +326,21 @@ public void isDefaultNoargConstructor_explicitNoargConstructor() {
unitTestBuilder
.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/ExplicitNoargConstructorTest.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- ExecutableElement constructor = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_CONSTRUCTOR)
- .getResult().get(0);
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ ExecutableElement constructor = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_CONSTRUCTOR)
+ .getResult().get(0);
- MatcherAssert.assertThat("Should return false for explicit constructor", !BeanUtils.isDefaultNoargConstructor(constructor));
- MatcherAssert.assertThat("Should return false for explicit constructor", !BeanUtils.hasDefaultNoargsConstructor(element));
- }
- })
+ MatcherAssert.assertThat("Should return false for explicit constructor", !BeanUtils.isDefaultNoargConstructor(constructor));
+ MatcherAssert.assertThat("Should return false for explicit constructor", !BeanUtils.hasDefaultNoargsConstructor(element));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -329,21 +350,23 @@ public void isDefaultNoargConstructor_explicitNoargConstructor2() {
unitTestBuilder
.useSource(JavaFileObjectUtils.readFromResource("testcases.beanutils/ExplicitNoargConstructorTest2.java"))
- .useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- ExecutableElement constructor = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.IS_CONSTRUCTOR)
- .getResult().get(0);
+ .defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
+ ExecutableElement constructor = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.IS_CONSTRUCTOR)
+ .getResult().get(0);
- List extends StatementTree> statements = ProcessingEnvironmentUtils.getTrees().getTree(constructor).getBody().getStatements();
+ List extends StatementTree> statements = ProcessingEnvironmentUtils.getTrees().getTree(constructor).getBody().getStatements();
- MatcherAssert.assertThat("Should return true for explicit constructor that looks like default constructor", BeanUtils.isDefaultNoargConstructor(constructor));
- MatcherAssert.assertThat("Should return true for explicit constructor that looks like default constructor", BeanUtils.hasDefaultNoargsConstructor(element));
+ MatcherAssert.assertThat("Should return true for explicit constructor that looks like default constructor", BeanUtils.isDefaultNoargConstructor(constructor));
+ MatcherAssert.assertThat("Should return true for explicit constructor that looks like default constructor", BeanUtils.hasDefaultNoargsConstructor(element));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/ElementUtilsTest.java b/tools/src/test/java/io/toolisticon/aptk/tools/ElementUtilsTest.java
index 2029ed2c..8a0723b1 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/ElementUtilsTest.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/ElementUtilsTest.java
@@ -1,13 +1,16 @@
package io.toolisticon.aptk.tools;
+import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.aptk.tools.corematcher.AptkCoreMatchers;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.JavaFileObjectUtils;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
@@ -23,7 +26,7 @@
*/
public class ElementUtilsTest {
- private CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder
+ private CompileTestBuilderApi.UnitTestBuilder unitTestBuilder = CompileTestBuilder
.unitTest()
.useSource(JavaFileObjectUtils.readFromResource("/AnnotationProcessorTestClass.java"));
@@ -36,23 +39,24 @@ public void init() {
@Test
public void getEnclosedElementsByName() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // find field
- List extends Element> result = ElementUtils.AccessEnclosedElements.getEnclosedElementsByName(element, "privateField");
- MatcherAssert.assertThat(result, Matchers.hasSize(1));
- MatcherAssert.assertThat(result.get(0).getKind(), Matchers.is(ElementKind.FIELD));
- MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("privateField"));
+ // find field
+ List extends Element> result = ElementUtils.AccessEnclosedElements.getEnclosedElementsByName(element, "privateField");
+ MatcherAssert.assertThat(result, Matchers.hasSize(1));
+ MatcherAssert.assertThat(result.get(0).getKind(), Matchers.is(ElementKind.FIELD));
+ MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("privateField"));
- // shouldn't find nonexisting
- result = ElementUtils.AccessEnclosedElements.getEnclosedElementsByName(element, "XXXXXXXX");
- MatcherAssert.assertThat(result, Matchers.empty());
+ // shouldn't find nonexisting
+ result = ElementUtils.AccessEnclosedElements.getEnclosedElementsByName(element, "XXXXXXXX");
+ MatcherAssert.assertThat(result, Matchers.empty());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -61,23 +65,24 @@ protected void testCase(TypeElement element) {
@Test
public void getEnclosedElementsByNameRegex() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> results = ElementUtils.AccessEnclosedElements.getEnclosedElementsByNameRegex(element, ".*ublic.*");
- MatcherAssert.assertThat(results, Matchers.hasSize(4));
- for (Element result : results) {
- MatcherAssert.assertThat(result.getKind(), Matchers.is(ElementKind.FIELD));
- MatcherAssert.assertThat(result.getSimpleName().toString(), Matchers.startsWith("public"));
- }
+ List extends Element> results = ElementUtils.AccessEnclosedElements.getEnclosedElementsByNameRegex(element, ".*ublic.*");
+ MatcherAssert.assertThat(results, Matchers.hasSize(4));
+ for (Element result : results) {
+ MatcherAssert.assertThat(result.getKind(), Matchers.is(ElementKind.FIELD));
+ MatcherAssert.assertThat(result.getSimpleName().toString(), Matchers.startsWith("public"));
+ }
- // shouldn't find nonexisting
- results = ElementUtils.AccessEnclosedElements.getEnclosedElementsByNameRegex(element, "XXXXXXXX");
- MatcherAssert.assertThat(results, Matchers.empty());
+ // shouldn't find nonexisting
+ results = ElementUtils.AccessEnclosedElements.getEnclosedElementsByNameRegex(element, "XXXXXXXX");
+ MatcherAssert.assertThat(results, Matchers.empty());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -85,16 +90,17 @@ protected void testCase(TypeElement element) {
@Test
public void hasModifiers() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Class should have public modifier", AptkCoreMatchers.BY_MODIFIER.getValidator().hasAllOf(element, Modifier.PUBLIC));
- MatcherAssert.assertThat("Class should not have abstract modifier", !AptkCoreMatchers.BY_MODIFIER.getValidator().hasAllOf(element, Modifier.PUBLIC, Modifier.ABSTRACT));
+ MatcherAssert.assertThat("Class should have public modifier", AptkCoreMatchers.BY_MODIFIER.getValidator().hasAllOf(element, Modifier.PUBLIC));
+ MatcherAssert.assertThat("Class should not have abstract modifier", !AptkCoreMatchers.BY_MODIFIER.getValidator().hasAllOf(element, Modifier.PUBLIC, Modifier.ABSTRACT));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -102,19 +108,20 @@ protected void testCase(TypeElement element) {
@Test
public void hasPublicModifier() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Class should be detected to have public modifier", ElementUtils.CheckModifierOfElement.hasPublicModifier(element));
+ MatcherAssert.assertThat("Class should be detected to have public modifier", ElementUtils.CheckModifierOfElement.hasPublicModifier(element));
- MatcherAssert.assertThat("Class should not be detected to have public modifier", !ElementUtils.CheckModifierOfElement.hasPublicModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
+ MatcherAssert.assertThat("Class should not be detected to have public modifier", !ElementUtils.CheckModifierOfElement.hasPublicModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have public modifier", !ElementUtils.CheckModifierOfElement.hasPublicModifier(null));
+ MatcherAssert.assertThat("Class should not be detected to have public modifier", !ElementUtils.CheckModifierOfElement.hasPublicModifier(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -122,19 +129,20 @@ protected void testCase(TypeElement element) {
@Test
public void hasProtectedModifier() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Class should be detected to have protected modifier", ElementUtils.CheckModifierOfElement.hasProtectedModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "protectedField").get(0)));
+ MatcherAssert.assertThat("Class should be detected to have protected modifier", ElementUtils.CheckModifierOfElement.hasProtectedModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "protectedField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have protected modifier", !ElementUtils.CheckModifierOfElement.hasProtectedModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
+ MatcherAssert.assertThat("Class should not be detected to have protected modifier", !ElementUtils.CheckModifierOfElement.hasProtectedModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have protected modifier", !ElementUtils.CheckModifierOfElement.hasProtectedModifier(null));
+ MatcherAssert.assertThat("Class should not be detected to have protected modifier", !ElementUtils.CheckModifierOfElement.hasProtectedModifier(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -142,19 +150,20 @@ protected void testCase(TypeElement element) {
@Test
public void hasPrivateModifier() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Class should be detected to have private modifier", ElementUtils.CheckModifierOfElement.hasPrivateModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
+ MatcherAssert.assertThat("Class should be detected to have private modifier", ElementUtils.CheckModifierOfElement.hasPrivateModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have private modifier", !ElementUtils.CheckModifierOfElement.hasPrivateModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "protectedField").get(0)));
+ MatcherAssert.assertThat("Class should not be detected to have private modifier", !ElementUtils.CheckModifierOfElement.hasPrivateModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "protectedField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have private modifier", !ElementUtils.CheckModifierOfElement.hasPrivateModifier(null));
+ MatcherAssert.assertThat("Class should not be detected to have private modifier", !ElementUtils.CheckModifierOfElement.hasPrivateModifier(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -162,22 +171,23 @@ protected void testCase(TypeElement element) {
@Test
public void hasAbstractModifier() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- Element abstractType = AptkCoreMatchers.BY_MODIFIER.getFilter().filterByAllOf(AptkCoreMatchers.BY_ELEMENT_KIND.getFilter().filterByOneOf(element.getEnclosedElements(), ElementKind.CLASS), Modifier.ABSTRACT).get(0);
+ Element abstractType = AptkCoreMatchers.BY_MODIFIER.getFilter().filterByAllOf(AptkCoreMatchers.BY_ELEMENT_KIND.getFilter().filterByOneOf(element.getEnclosedElements(), ElementKind.CLASS), Modifier.ABSTRACT).get(0);
- MatcherAssert.assertThat("Class should be detected to have abstract modifier", ElementUtils.CheckModifierOfElement.hasAbstractModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(abstractType.getEnclosedElements(), "abstractMethod").get(0)))
- ;
+ MatcherAssert.assertThat("Class should be detected to have abstract modifier", ElementUtils.CheckModifierOfElement.hasAbstractModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(abstractType.getEnclosedElements(), "abstractMethod").get(0)))
+ ;
- MatcherAssert.assertThat("Class should not be detected to have abstract modifier", !ElementUtils.CheckModifierOfElement.hasAbstractModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
+ MatcherAssert.assertThat("Class should not be detected to have abstract modifier", !ElementUtils.CheckModifierOfElement.hasAbstractModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have abstract modifier", !ElementUtils.CheckModifierOfElement.hasAbstractModifier(null));
+ MatcherAssert.assertThat("Class should not be detected to have abstract modifier", !ElementUtils.CheckModifierOfElement.hasAbstractModifier(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -185,19 +195,20 @@ protected void testCase(TypeElement element) {
@Test
public void hasStaticModifier() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Class should be detected to have static modifier", ElementUtils.CheckModifierOfElement.hasStaticModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "publicStaticField").get(0)));
+ MatcherAssert.assertThat("Class should be detected to have static modifier", ElementUtils.CheckModifierOfElement.hasStaticModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "publicStaticField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have static modifier", !ElementUtils.CheckModifierOfElement.hasStaticModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
+ MatcherAssert.assertThat("Class should not be detected to have static modifier", !ElementUtils.CheckModifierOfElement.hasStaticModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have static modifier", !ElementUtils.CheckModifierOfElement.hasStaticModifier(null));
+ MatcherAssert.assertThat("Class should not be detected to have static modifier", !ElementUtils.CheckModifierOfElement.hasStaticModifier(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -205,19 +216,20 @@ protected void testCase(TypeElement element) {
@Test
public void hasFinalModifier() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Class should be detected to have final modifier", ElementUtils.CheckModifierOfElement.hasFinalModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "publicFinalField").get(0)));
+ MatcherAssert.assertThat("Class should be detected to have final modifier", ElementUtils.CheckModifierOfElement.hasFinalModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "publicFinalField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have final modifier", !ElementUtils.CheckModifierOfElement.hasFinalModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
+ MatcherAssert.assertThat("Class should not be detected to have final modifier", !ElementUtils.CheckModifierOfElement.hasFinalModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have final modifier", !ElementUtils.CheckModifierOfElement.hasFinalModifier(null));
+ MatcherAssert.assertThat("Class should not be detected to have final modifier", !ElementUtils.CheckModifierOfElement.hasFinalModifier(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -225,19 +237,20 @@ protected void testCase(TypeElement element) {
@Test
public void hasTransientModifier() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Class should be detected to have transient modifier", ElementUtils.CheckModifierOfElement.hasTransientModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "publicTransientField").get(0)));
+ MatcherAssert.assertThat("Class should be detected to have transient modifier", ElementUtils.CheckModifierOfElement.hasTransientModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "publicTransientField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have transient modifier", !ElementUtils.CheckModifierOfElement.hasTransientModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
+ MatcherAssert.assertThat("Class should not be detected to have transient modifier", !ElementUtils.CheckModifierOfElement.hasTransientModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have transient modifier", !ElementUtils.CheckModifierOfElement.hasTransientModifier(null));
+ MatcherAssert.assertThat("Class should not be detected to have transient modifier", !ElementUtils.CheckModifierOfElement.hasTransientModifier(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -245,19 +258,20 @@ protected void testCase(TypeElement element) {
@Test
public void hasSynchronizedModifier() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("Class should be detected to have synchronized modifier", ElementUtils.CheckModifierOfElement.hasSynchronizedModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "synchronizedMethod").get(0)));
+ MatcherAssert.assertThat("Class should be detected to have synchronized modifier", ElementUtils.CheckModifierOfElement.hasSynchronizedModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "synchronizedMethod").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have synchronized modifier", !ElementUtils.CheckModifierOfElement.hasSynchronizedModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
+ MatcherAssert.assertThat("Class should not be detected to have synchronized modifier", !ElementUtils.CheckModifierOfElement.hasSynchronizedModifier(AptkCoreMatchers.BY_NAME.getFilter().filterByOneOf(element.getEnclosedElements(), "privateField").get(0)));
- MatcherAssert.assertThat("Class should not be detected to have synchronized modifier", !ElementUtils.CheckModifierOfElement.hasSynchronizedModifier(null));
+ MatcherAssert.assertThat("Class should not be detected to have synchronized modifier", !ElementUtils.CheckModifierOfElement.hasSynchronizedModifier(null));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -265,21 +279,22 @@ protected void testCase(TypeElement element) {
@Test
public void getEnclosedFields() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends VariableElement> fields = ElementUtils.AccessEnclosedElements.getEnclosedFields(element);
+ List extends VariableElement> fields = ElementUtils.AccessEnclosedElements.getEnclosedFields(element);
- MatcherAssert.assertThat(fields, Matchers.notNullValue());
- MatcherAssert.assertThat(fields, Matchers.not(Matchers.empty()));
+ MatcherAssert.assertThat(fields, Matchers.notNullValue());
+ MatcherAssert.assertThat(fields, Matchers.not(Matchers.empty()));
- for (VariableElement field : fields) {
- MatcherAssert.assertThat(field.getKind(), Matchers.is(ElementKind.FIELD));
- }
+ for (VariableElement field : fields) {
+ MatcherAssert.assertThat(field.getKind(), Matchers.is(ElementKind.FIELD));
+ }
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -287,20 +302,21 @@ protected void testCase(TypeElement element) {
@Test
public void getEnclosedMethods() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends ExecutableElement> methods = ElementUtils.AccessEnclosedElements.getEnclosedMethods(element);
+ List extends ExecutableElement> methods = ElementUtils.AccessEnclosedElements.getEnclosedMethods(element);
- MatcherAssert.assertThat(methods, Matchers.notNullValue());
- MatcherAssert.assertThat(methods, Matchers.not(Matchers.empty()));
+ MatcherAssert.assertThat(methods, Matchers.notNullValue());
+ MatcherAssert.assertThat(methods, Matchers.not(Matchers.empty()));
- for (ExecutableElement method : methods) {
- MatcherAssert.assertThat(method.getKind(), Matchers.is(ElementKind.METHOD));
- }
- }
- })
+ for (ExecutableElement method : methods) {
+ MatcherAssert.assertThat(method.getKind(), Matchers.is(ElementKind.METHOD));
+ }
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -308,20 +324,21 @@ protected void testCase(TypeElement element) {
@Test
public void getEnclosedConstructors() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends ExecutableElement> constructors = ElementUtils.AccessEnclosedElements.getEnclosedConstructors(element);
+ List extends ExecutableElement> constructors = ElementUtils.AccessEnclosedElements.getEnclosedConstructors(element);
- MatcherAssert.assertThat(constructors, Matchers.notNullValue());
- MatcherAssert.assertThat(constructors, Matchers.not(Matchers.empty()));
+ MatcherAssert.assertThat(constructors, Matchers.notNullValue());
+ MatcherAssert.assertThat(constructors, Matchers.not(Matchers.empty()));
- for (ExecutableElement constructor : constructors) {
- MatcherAssert.assertThat(constructor.getKind(), Matchers.is(ElementKind.CONSTRUCTOR));
- }
- }
- })
+ for (ExecutableElement constructor : constructors) {
+ MatcherAssert.assertThat(constructor.getKind(), Matchers.is(ElementKind.CONSTRUCTOR));
+ }
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -329,21 +346,22 @@ protected void testCase(TypeElement element) {
@Test
public void getEnclosedTypes() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends TypeElement> types = ElementUtils.AccessEnclosedElements.getEnclosedTypes(element);
+ List extends TypeElement> types = ElementUtils.AccessEnclosedElements.getEnclosedTypes(element);
- MatcherAssert.assertThat(types, Matchers.notNullValue());
- MatcherAssert.assertThat(types, Matchers.not(Matchers.empty()));
+ MatcherAssert.assertThat(types, Matchers.notNullValue());
+ MatcherAssert.assertThat(types, Matchers.not(Matchers.empty()));
- for (TypeElement type : types) {
- MatcherAssert.assertThat(type.getKind(), Matchers.is(ElementKind.CLASS));
- }
+ for (TypeElement type : types) {
+ MatcherAssert.assertThat(type.getKind(), Matchers.is(ElementKind.CLASS));
+ }
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -351,21 +369,22 @@ protected void testCase(TypeElement element) {
@Test
public void getEnclosedElementsWithAllAnnotationsOf() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List elements = (List) ElementUtils.AccessEnclosedElements.getEnclosedElementsWithAllAnnotationsOf(element, FilterTestAnnotation1.class);
+ List elements = (List) ElementUtils.AccessEnclosedElements.getEnclosedElementsWithAllAnnotationsOf(element, FilterTestAnnotation1.class);
- MatcherAssert.assertThat(elements, Matchers.notNullValue());
- MatcherAssert.assertThat(elements, Matchers.not(Matchers.empty()));
+ MatcherAssert.assertThat(elements, Matchers.notNullValue());
+ MatcherAssert.assertThat(elements, Matchers.not(Matchers.empty()));
- for (Element element1 : elements) {
- MatcherAssert.assertThat(element1.getAnnotation(FilterTestAnnotation1.class), Matchers.notNullValue());
- }
+ for (Element element1 : elements) {
+ MatcherAssert.assertThat(element1.getAnnotation(FilterTestAnnotation1.class), Matchers.notNullValue());
+ }
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -373,25 +392,26 @@ protected void testCase(TypeElement element) {
@Test
public void getEnclosedElementsWithAllAnnotationsOf_withNullValuedElementOrAnnotation() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List elements = (List) ElementUtils.AccessEnclosedElements.getEnclosedElementsWithAllAnnotationsOf(null, FilterTestAnnotation1.class);
+ List elements = (List) ElementUtils.AccessEnclosedElements.getEnclosedElementsWithAllAnnotationsOf(null, FilterTestAnnotation1.class);
- MatcherAssert.assertThat(elements, Matchers.empty());
+ MatcherAssert.assertThat(elements, Matchers.empty());
- elements = (List) ElementUtils.AccessEnclosedElements.getEnclosedElementsWithAllAnnotationsOf(element, null);
+ elements = (List) ElementUtils.AccessEnclosedElements.getEnclosedElementsWithAllAnnotationsOf(element, null);
- MatcherAssert.assertThat(elements, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(elements, Matchers.hasSize(element.getEnclosedElements().size()));
- elements = (List) ElementUtils.AccessEnclosedElements.getEnclosedElementsWithAllAnnotationsOf(element);
+ elements = (List) ElementUtils.AccessEnclosedElements.getEnclosedElementsWithAllAnnotationsOf(element);
- MatcherAssert.assertThat(elements, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(elements, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/ElementUtils_AccessTypeHierarchyTest.java b/tools/src/test/java/io/toolisticon/aptk/tools/ElementUtils_AccessTypeHierarchyTest.java
index 3ce76ced..d11a9485 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/ElementUtils_AccessTypeHierarchyTest.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/ElementUtils_AccessTypeHierarchyTest.java
@@ -1,12 +1,15 @@
package io.toolisticon.aptk.tools;
+import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.JavaFileObjectUtils;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.TypeElement;
import java.util.Arrays;
@@ -34,7 +37,7 @@ public static class TestType extends InbetweenType {
}
- private CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder
+ private CompileTestBuilderApi.UnitTestBuilder unitTestBuilder = CompileTestBuilder
.unitTest()
.useSource(JavaFileObjectUtils.readFromResource("/AnnotationValueUtilsTestClass.java"));
@@ -47,21 +50,22 @@ public void init() {
@Test
public void getDirectSuperTypeElements() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- // find field
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ // find field
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
- MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
- TypeElement inBetweenTypeElement = TypeUtils.TypeRetrieval.getTypeElement(InbetweenType.class);
+ TypeElement inBetweenTypeElement = TypeUtils.TypeRetrieval.getTypeElement(InbetweenType.class);
- MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElements(typeElement)), Matchers.contains(
- inBetweenTypeElement));
+ MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElements(typeElement)), Matchers.contains(
+ inBetweenTypeElement));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -70,29 +74,30 @@ protected void testCase(TypeElement element) {
@Test
public void getSuperTypeElements() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- // find field
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ // find field
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
- MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
- TypeElement inBetweenTypeElement = TypeUtils.TypeRetrieval.getTypeElement(InbetweenType.class);
- TypeElement topMostTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TopMostType.class);
- TypeElement objectTypeElement = TypeUtils.TypeRetrieval.getTypeElement(Object.class);
- TypeElement testInterfaceTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TestInterface.class);
+ TypeElement inBetweenTypeElement = TypeUtils.TypeRetrieval.getTypeElement(InbetweenType.class);
+ TypeElement topMostTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TopMostType.class);
+ TypeElement objectTypeElement = TypeUtils.TypeRetrieval.getTypeElement(Object.class);
+ TypeElement testInterfaceTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TestInterface.class);
- MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getSuperTypeElements(typeElement)), Matchers.contains(
- inBetweenTypeElement,
- topMostTypeElement,
- objectTypeElement,
- testInterfaceTypeElement));
+ MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getSuperTypeElements(typeElement)), Matchers.contains(
+ inBetweenTypeElement,
+ topMostTypeElement,
+ objectTypeElement,
+ testInterfaceTypeElement));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -100,31 +105,32 @@ protected void testCase(TypeElement element) {
@Test
public void getDirectSuperTypeElementsOfKindType() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- // Test 1 : has super type
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ // Test 1 : has super type
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
- MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
- TypeElement inBetweenTypeElement = TypeUtils.TypeRetrieval.getTypeElement(InbetweenType.class);
+ TypeElement inBetweenTypeElement = TypeUtils.TypeRetrieval.getTypeElement(InbetweenType.class);
- MatcherAssert.assertThat(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElementOfKindType(typeElement), Matchers.equalTo(
- inBetweenTypeElement
- ));
+ MatcherAssert.assertThat(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElementOfKindType(typeElement), Matchers.equalTo(
+ inBetweenTypeElement
+ ));
- // Test 2 : has no super type
- typeElement = TypeUtils.TypeRetrieval.getTypeElement(Object.class);
+ // Test 2 : has no super type
+ typeElement = TypeUtils.TypeRetrieval.getTypeElement(Object.class);
- MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
- MatcherAssert.assertThat(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElementOfKindType(typeElement), Matchers.nullValue());
+ MatcherAssert.assertThat(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElementOfKindType(typeElement), Matchers.nullValue());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -132,29 +138,30 @@ protected void testCase(TypeElement element) {
@Test
public void getDirectSuperTypeElementsOfKindInterface() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- // Test 1: has no interface
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ // Test 1: has no interface
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
- MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
- MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElementsOfKindInterface(typeElement)), Matchers.empty());
+ MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElementsOfKindInterface(typeElement)), Matchers.empty());
- // Test 2: has interface
- typeElement = TypeUtils.TypeRetrieval.getTypeElement(TopMostType.class);
+ // Test 2: has interface
+ typeElement = TypeUtils.TypeRetrieval.getTypeElement(TopMostType.class);
- MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
- TypeElement testInterfaceTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TestInterface.class);
+ TypeElement testInterfaceTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TestInterface.class);
- MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElementsOfKindInterface(typeElement)), Matchers.contains(testInterfaceTypeElement));
+ MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getDirectSuperTypeElementsOfKindInterface(typeElement)), Matchers.contains(testInterfaceTypeElement));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -162,28 +169,30 @@ protected void testCase(TypeElement element) {
@Test
public void getSuperTypeElementsOfKindType() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- // find field
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ // find field
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
- TypeElement inBetweenTypeElement = TypeUtils.TypeRetrieval.getTypeElement(InbetweenType.class);
- TypeElement topMostTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TopMostType.class);
- TypeElement objectTypeElement = TypeUtils.TypeRetrieval.getTypeElement(Object.class);
+ MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ TypeElement inBetweenTypeElement = TypeUtils.TypeRetrieval.getTypeElement(InbetweenType.class);
+ TypeElement topMostTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TopMostType.class);
+ TypeElement objectTypeElement = TypeUtils.TypeRetrieval.getTypeElement(Object.class);
- MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getSuperTypeElementsOfKindType(typeElement)), Matchers.contains(
- inBetweenTypeElement,
- topMostTypeElement,
- objectTypeElement
- ));
+ MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getSuperTypeElementsOfKindType(typeElement)), Matchers.contains(
+ inBetweenTypeElement,
+ topMostTypeElement,
+ objectTypeElement
+ ));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -191,23 +200,24 @@ protected void testCase(TypeElement element) {
@Test
public void getSuperTypeElementsOfKindInterface() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
- // find field
- TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ // find field
+ TypeElement typeElement = TypeUtils.TypeRetrieval.getTypeElement(TestType.class);
- MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
+ MatcherAssert.assertThat("PRECONDITION : typelement must not be null", typeElement != null);
- TypeElement testInterfaceTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TestInterface.class);
+ TypeElement testInterfaceTypeElement = TypeUtils.TypeRetrieval.getTypeElement(TestInterface.class);
- MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getSuperTypeElementsOfKindInterface(typeElement)), Matchers.contains(
- testInterfaceTypeElement
- ));
+ MatcherAssert.assertThat(Arrays.asList(ElementUtils.AccessTypeHierarchy.getSuperTypeElementsOfKindInterface(typeElement)), Matchers.contains(
+ testInterfaceTypeElement
+ ));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/FilerUtilsTest.java b/tools/src/test/java/io/toolisticon/aptk/tools/FilerUtilsTest.java
index 4ffdc48c..3d4831ff 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/FilerUtilsTest.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/FilerUtilsTest.java
@@ -2,6 +2,7 @@
import io.toolisticon.aptk.tools.generators.FileObjectUtilsTestAnnotationProcessor;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.JavaFileObjectUtils;
import org.junit.Before;
import org.junit.Test;
@@ -16,16 +17,16 @@ public void init() {
MessagerUtils.setPrintMessageCodes(true);
}
- private CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder
- .unitTest()
- .useSource(JavaFileObjectUtils.readFromResource("/AnnotationProcessorTestClass.java"));
+ private CompileTestBuilderApi.CompilationTestBuilder compilationTestBuilder = CompileTestBuilder
+ .compilationTest()
+ .addSources(JavaFileObjectUtils.readFromResource("/AnnotationProcessorTestClass.java"));
@Test
public void testValidUsage() {
- unitTestBuilder.useProcessor(new FileObjectUtilsTestAnnotationProcessor())
- .useSource(JavaFileObjectUtils.readFromResource("/testcases/generators/FilerUtilsTestClass.java"))
+ compilationTestBuilder.addProcessors(FileObjectUtilsTestAnnotationProcessor.class)
+ .addSources(JavaFileObjectUtils.readFromResource("/testcases/generators/FilerUtilsTestClass.java"))
.compilationShouldSucceed()
.expectThatFileObjectExists(StandardLocation.CLASS_OUTPUT, "", "testOutput.txt", JavaFileObjectUtils.readFromResource("/testcases/generators/expectedResult.txt"))
.executeTest();
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/FluentElementFilterTest.java b/tools/src/test/java/io/toolisticon/aptk/tools/FluentElementFilterTest.java
index 563aeb99..dc0dec5c 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/FluentElementFilterTest.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/FluentElementFilterTest.java
@@ -1,14 +1,18 @@
package io.toolisticon.aptk.tools;
+import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.aptk.tools.corematcher.AptkCoreMatchers;
import io.toolisticon.aptk.tools.fluentfilter.FluentElementFilter;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.JavaFileObjectUtils;
+import io.toolisticon.cute.TestAnnotation;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
@@ -23,7 +27,7 @@
public class FluentElementFilterTest {
- private CompileTestBuilder.UnitTestBuilder unitTestBuilder = CompileTestBuilder
+ private CompileTestBuilderApi.UnitTestBuilder unitTestBuilder = CompileTestBuilder
.unitTest()
.useSource(JavaFileObjectUtils.readFromResource("/AnnotationProcessorTestClass.java"));
@@ -36,22 +40,24 @@ public void init() {
@Test
public void filterByKinds() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
- .getResult();
- MatcherAssert.assertThat(results, Matchers.hasSize(8));
+ List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
+ .getResult();
- for (Element resultElement : results) {
- MatcherAssert.assertThat(resultElement.getKind(), Matchers.is(ElementKind.FIELD));
- }
+ MatcherAssert.assertThat(results, Matchers.hasSize(8));
- }
- })
+ for (Element resultElement : results) {
+ MatcherAssert.assertThat(resultElement.getKind(), Matchers.is(ElementKind.FIELD));
+ }
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -60,21 +66,23 @@ protected void testCase(TypeElement element) {
@Test
public void filterByKinds_and_filterByModifiers() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
- .applyFilter(AptkCoreMatchers.BY_MODIFIER).filterByAllOf(Modifier.PUBLIC, Modifier.STATIC)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
+ .applyFilter(AptkCoreMatchers.BY_MODIFIER).filterByAllOf(Modifier.PUBLIC, Modifier.STATIC)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(1));
- MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("publicStaticField"));
+ MatcherAssert.assertThat(result, Matchers.hasSize(1));
+ MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("publicStaticField"));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -82,19 +90,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByKinds_nullValuedElement() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> results = FluentElementFilter.createFluentElementFilter((List) null)
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
- .getResult();
- MatcherAssert.assertThat(results, Matchers.hasSize(0));
+ List extends Element> results = FluentElementFilter.createFluentElementFilter((List) null)
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
+ .getResult();
+ MatcherAssert.assertThat(results, Matchers.hasSize(0));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -102,18 +112,20 @@ protected void testCase(TypeElement element) {
@Test
public void filterByKinds_nullValuedFilterArgument_shouldReturnUnfilteredListElement() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(null)
- .getResult();
+ List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(null)
+ .getResult();
- MatcherAssert.assertThat(results, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(results, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -121,19 +133,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByKinds_shouldReturnUnfilteredListForNonExistingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf()
- .getResult();
- MatcherAssert.assertThat(results, Matchers.hasSize(element.getEnclosedElements().size()));
+ List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf()
+ .getResult();
+ MatcherAssert.assertThat(results, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -143,23 +157,25 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByKinds_returnListForMatchingFilterArguments() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
- .getResult();
+ List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
+ .getResult();
- MatcherAssert.assertThat(results, Matchers.hasSize(element.getEnclosedElements().size() - 8));
+ MatcherAssert.assertThat(results, Matchers.hasSize(element.getEnclosedElements().size() - 8));
- for (Element resultElement : results) {
- MatcherAssert.assertThat(resultElement.getKind(), Matchers.not(ElementKind.FIELD));
- }
+ for (Element resultElement : results) {
+ MatcherAssert.assertThat(resultElement.getKind(), Matchers.not(ElementKind.FIELD));
+ }
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -167,19 +183,21 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByKinds_nullValuedElement() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- List extends Element> results = FluentElementFilter.createFluentElementFilter((List) null)
- .applyInvertedFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
- .getResult();
+ List extends Element> results = FluentElementFilter.createFluentElementFilter((List) null)
+ .applyInvertedFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(ElementKind.FIELD)
+ .getResult();
- MatcherAssert.assertThat(results, Matchers.hasSize(0));
+ MatcherAssert.assertThat(results, Matchers.hasSize(0));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -188,19 +206,21 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByKinds_shouldReturnEmptyListForInvertedFilteringWithNullValuedFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(null)
- .getResult();
- MatcherAssert.assertThat(results, Matchers.empty());
+ List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf(null)
+ .getResult();
+ MatcherAssert.assertThat(results, Matchers.empty());
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -208,18 +228,20 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByKinds_shouldReturnEmptyListForNonInvertedFNonExistingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf()
- .getResult();
+ List extends Element> results = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_ELEMENT_KIND).filterByOneOf()
+ .getResult();
- MatcherAssert.assertThat(results, Matchers.empty());
+ MatcherAssert.assertThat(results, Matchers.empty());
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -227,21 +249,23 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNames_shouldReturnListForOneMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // one search attribute
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("publicStaticField")
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(1));
- MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("publicStaticField"));
+ // one search attribute
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("publicStaticField")
+ .getResult();
+ MatcherAssert.assertThat(result, Matchers.hasSize(1));
+ MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("publicStaticField"));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -250,21 +274,23 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNames_shouldReturnListForTwoMatchingFilterArguments() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // two search attributes
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("publicStaticField", "synchronizedMethod")
- .getResult();
+ // two search attributes
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("publicStaticField", "synchronizedMethod")
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(2));
- MatcherAssert.assertThat(convertToList(result.get(0).getSimpleName().toString(), result.get(1).getSimpleName().toString()), Matchers.containsInAnyOrder("publicStaticField", "synchronizedMethod"));
+ MatcherAssert.assertThat(result, Matchers.hasSize(2));
+ MatcherAssert.assertThat(convertToList(result.get(0).getSimpleName().toString(), result.get(1).getSimpleName().toString()), Matchers.containsInAnyOrder("publicStaticField", "synchronizedMethod"));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -272,19 +298,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNames_shouldReturnEmptyListForNonMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // returns empty result
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("XXX")
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ // returns empty result
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("XXX")
+ .getResult();
- }
- })
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -292,19 +320,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNames_shouldReturnUnfilteredListForNonExistingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // handle no passed filter args correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf()
- .getResult();
+ // handle no passed filter args correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf()
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -312,19 +342,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNames_shouldReturnUnfilteredListForNullValuedFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // handle nulls correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(null)
- .getResult();
+ // handle nulls correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(null)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -332,20 +364,22 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNames_shouldReturnEmptyListForNullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // null valued element list
- List extends Element> result =
- FluentElementFilter.createFluentElementFilter((List) null)
- .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(null)
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ // null valued element list
+ List extends Element> result =
+ FluentElementFilter.createFluentElementFilter((List) null)
+ .applyFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(null)
+ .getResult();
- }
- })
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -356,24 +390,26 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByNames_shouldReturnListForOneMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // one search attribute
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("publicStaticField")
- .getResult();
+ // one search attribute
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("publicStaticField")
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size() - 1));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size() - 1));
- for (Element resultElement : result) {
- MatcherAssert.assertThat(resultElement.getSimpleName().toString(), Matchers.not("publicStaticField"));
- }
+ for (Element resultElement : result) {
+ MatcherAssert.assertThat(resultElement.getSimpleName().toString(), Matchers.not("publicStaticField"));
+ }
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -381,23 +417,25 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByNames_shouldReturnListForTwoMatchingFilterArguments() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // two search attributes
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("publicStaticField", "synchronizedMethod")
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size() - 2));
- for (Element resultElement : result) {
- MatcherAssert.assertThat("Must nor be publicStaticField or synchronizedMethod", !resultElement.getSimpleName().equals("publicStaticField") && !resultElement.getSimpleName().equals("synchronizedMethod"));
- }
+ // two search attributes
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("publicStaticField", "synchronizedMethod")
+ .getResult();
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size() - 2));
+ for (Element resultElement : result) {
+ MatcherAssert.assertThat("Must nor be publicStaticField or synchronizedMethod", !resultElement.getSimpleName().equals("publicStaticField") && !resultElement.getSimpleName().equals("synchronizedMethod"));
+ }
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -405,20 +443,22 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByNames_shouldReturnEmptyListForNonMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // returns empty result
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("XXX")
- .getResult();
+ // returns empty result
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf("XXX")
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -426,20 +466,21 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByNames_shouldReturnEmptyListForNonExistingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // handle no passed filter args correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf()
- .getResult();
+ // handle no passed filter args correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf()
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -447,20 +488,22 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByNames_shouldReturnEmptyListForInvertedFilteringWithNullValuedFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // handle nulls correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(null)
- .getResult();
- MatcherAssert.assertThat(result, Matchers.empty());
+ // handle nulls correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(null)
+ .getResult();
+ MatcherAssert.assertThat(result, Matchers.empty());
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -468,21 +511,23 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByNames_shouldReturnEmptyListForNullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // null valued element list
- List extends Element> result =
- FluentElementFilter.createFluentElementFilter((List) null)
- .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(null)
- .getResult();
+ // null valued element list
+ List extends Element> result =
+ FluentElementFilter.createFluentElementFilter((List) null)
+ .applyInvertedFilter(AptkCoreMatchers.BY_NAME).filterByOneOf(null)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -490,21 +535,23 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNameWithRegularExpressions_shouldReturnNonEmptyListForOneMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // one search attribute
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf("publicSt.*Field")
- .getResult();
+ // one search attribute
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf("publicSt.*Field")
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(1));
- MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("publicStaticField"));
+ MatcherAssert.assertThat(result, Matchers.hasSize(1));
+ MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("publicStaticField"));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -513,21 +560,23 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNameWithRegularExpressions_shouldReturnListForTwoMatchingFilterArguments() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // two search attributes
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf("publicSt.*Field", "synchr.*Method")
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(2));
- MatcherAssert.assertThat(convertToList(result.get(0).getSimpleName().toString(), result.get(1).getSimpleName().toString()), Matchers.containsInAnyOrder("publicStaticField", "synchronizedMethod"));
+ // two search attributes
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf("publicSt.*Field", "synchr.*Method")
+ .getResult();
+ MatcherAssert.assertThat(result, Matchers.hasSize(2));
+ MatcherAssert.assertThat(convertToList(result.get(0).getSimpleName().toString(), result.get(1).getSimpleName().toString()), Matchers.containsInAnyOrder("publicStaticField", "synchronizedMethod"));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -535,19 +584,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNameWithRegularExpressions_shouldReturnEmptyListForNonMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // returns empty result
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf("XXX")
- .getResult();
+ // returns empty result
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf("XXX")
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -555,19 +606,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNameWithRegularExpressions_shouldReturnUnfilteredListForNonExistingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // handle no passed filter args correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf()
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ // handle no passed filter args correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf()
+ .getResult();
- }
- })
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -575,19 +628,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNameWithRegularExpressions_shouldReturnUnfilteredListForNullValuedFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // handle nulls correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf(null)
- .getResult();
+ // handle nulls correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf(null)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -595,19 +650,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByNameWithRegularExpressions_shouldReturnEmptyListForNullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // handle nulls correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter((List) null)
- .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf(null)
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ // handle nulls correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter((List) null)
+ .applyFilter(AptkCoreMatchers.BY_REGEX_NAME).filterByOneOf(null)
+ .getResult();
- }
- })
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -615,20 +672,22 @@ protected void testCase(TypeElement element) {
@Test
public void filterByAnnotation_shouldReturnEmptyListForOneMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(FilterTestAnnotation1.class)
- .getResult();
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(FilterTestAnnotation1.class)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(1));
- MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("synchronizedMethod"));
+ MatcherAssert.assertThat(result, Matchers.hasSize(1));
+ MatcherAssert.assertThat(result.get(0).getSimpleName().toString(), Matchers.is("synchronizedMethod"));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -637,21 +696,23 @@ protected void testCase(TypeElement element) {
@Test
public void filterByAnnotation_shouldReturnListForTwoMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // two search attributes
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(FilterTestAnnotation1.class, FilterTestAnnotation2.class)
- .getResult();
+ // two search attributes
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(FilterTestAnnotation1.class, FilterTestAnnotation2.class)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(1));
- MatcherAssert.assertThat(convertToList(result.get(0).getSimpleName().toString()), Matchers.containsInAnyOrder("synchronizedMethod"));
+ MatcherAssert.assertThat(result, Matchers.hasSize(1));
+ MatcherAssert.assertThat(convertToList(result.get(0).getSimpleName().toString()), Matchers.containsInAnyOrder("synchronizedMethod"));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -659,19 +720,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByAnnotation_shouldReturnEmptyListForNonMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // returns empty result
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(TestAnnotation.class)
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ // returns empty result
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(TestAnnotation.class)
+ .getResult();
- }
- })
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -679,19 +742,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByAnnotation_shouldReturnEmptyListForNonExistingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // handle no passed filter args correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf()
- .getResult();
+ // handle no passed filter args correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf()
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -699,19 +764,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByAnnotation_shouldReturnUnfilteredListForNullValuedFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // handle nulls correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(null)
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ // handle nulls correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(null)
+ .getResult();
- }
- })
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -719,19 +786,21 @@ protected void testCase(TypeElement element) {
@Test
public void filterByAnnotation_shouldReturnEmptyListForNullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // handle nulls correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter((List) null)
- .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(FilterTestAnnotation1.class)
- .getResult();
+ // handle nulls correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter((List) null)
+ .applyFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(FilterTestAnnotation1.class)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -743,23 +812,25 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByAnnotation_shouldReturnListForOneMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // one search attribute
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(FilterTestAnnotation1.class)
- .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size() - 1));
+ // one search attribute
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(FilterTestAnnotation1.class)
+ .getResult();
- for (Element resultElement : result) {
- MatcherAssert.assertThat(resultElement.getSimpleName().toString(), Matchers.not("synchronizedMethod"));
- }
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size() - 1));
- }
- })
+ for (Element resultElement : result) {
+ MatcherAssert.assertThat(resultElement.getSimpleName().toString(), Matchers.not("synchronizedMethod"));
+ }
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -767,23 +838,25 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByAnnotation_shouldReturnListForTwoMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // two search attributes
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(FilterTestAnnotation1.class, FilterTestAnnotation2.class)
- .getResult();
+ // two search attributes
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(FilterTestAnnotation1.class, FilterTestAnnotation2.class)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size() - 1));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size() - 1));
- for (Element resultElement : result) {
- MatcherAssert.assertThat(resultElement.getSimpleName().toString(), Matchers.not("synchronizedMethod"));
- }
+ for (Element resultElement : result) {
+ MatcherAssert.assertThat(resultElement.getSimpleName().toString(), Matchers.not("synchronizedMethod"));
+ }
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -791,19 +864,21 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByAnnotation_shouldReturnUnfilteredListForNonMatchingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // returns empty result
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(FilterTestAnnotation1.class, TestAnnotation.class)
- .getResult();
+ // returns empty result
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(FilterTestAnnotation1.class, TestAnnotation.class)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -811,19 +886,20 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByAnnotation_shouldReturnEmptyListForNonExistingFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // returns empty result
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(FilterTestAnnotation1.class, TestAnnotation.class)
- .getResult();
+ // returns empty result
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByAllOf(FilterTestAnnotation1.class, TestAnnotation.class)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
+ MatcherAssert.assertThat(result, Matchers.hasSize(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -832,20 +908,22 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByAnnotation_shouldReturnEmptyListForInvertedFilteringWithNullValuedFilterArgument() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // handle nulls correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
- .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(null)
- .getResult();
- MatcherAssert.assertThat(result, Matchers.empty());
+ // handle nulls correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter(element.getEnclosedElements())
+ .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(null)
+ .getResult();
+ MatcherAssert.assertThat(result, Matchers.empty());
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -853,20 +931,22 @@ protected void testCase(TypeElement element) {
@Test
public void inverseFilterByAnnotation_shouldReturnEmptyListForNullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // handle nulls correctly
- List extends Element> result = FluentElementFilter.createFluentElementFilter((List) null)
- .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(FilterTestAnnotation1.class)
- .getResult();
+ // handle nulls correctly
+ List extends Element> result = FluentElementFilter.createFluentElementFilter((List) null)
+ .applyInvertedFilter(AptkCoreMatchers.BY_ANNOTATION).filterByOneOf(FilterTestAnnotation1.class)
+ .getResult();
- MatcherAssert.assertThat(result, Matchers.hasSize(0));
+ MatcherAssert.assertThat(result, Matchers.hasSize(0));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -874,16 +954,18 @@ protected void testCase(TypeElement element) {
@Test
public void isEmpty_succeedingValidationWithEmptyElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // detects empty results correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(new ArrayList()).isEmpty(), Matchers.is(true));
+ // detects empty results correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(new ArrayList()).isEmpty(), Matchers.is(true));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -891,16 +973,18 @@ protected void testCase(TypeElement element) {
@Test
public void isEmpty_failingValidationWithNonEmptyElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects non empty result correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).isEmpty(), Matchers.is(false));
+ // detects non empty result correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).isEmpty(), Matchers.is(false));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -908,16 +992,18 @@ protected void testCase(TypeElement element) {
@Test
public void isEmpty_succeedingValidationWithNullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // detects non empty result correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).isEmpty(), Matchers.is(true));
+ // detects non empty result correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).isEmpty(), Matchers.is(true));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -925,16 +1011,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasSingleElement_failingValidationWithEmptyElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects empty results correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(new ArrayList()).hasSingleElement(), Matchers.is(false));
+ // detects empty results correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(new ArrayList()).hasSingleElement(), Matchers.is(false));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -942,16 +1030,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasSingleElement_succeedingValidationWithElementListWithSizeOne() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects single result elements correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(convertToList(element)).hasSingleElement(), Matchers.is(true));
+ // detects single result elements correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(convertToList(element)).hasSingleElement(), Matchers.is(true));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -959,16 +1049,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasSingleElement_failingValidationWithElementListWithSizeBiggerOne() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // detects multiple elements correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).hasSingleElement(), Matchers.is(false));
+ // detects multiple elements correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).hasSingleElement(), Matchers.is(false));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -976,16 +1068,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasSingleElement_failingValidationWithNullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects multiple elements correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).hasSingleElement(), Matchers.is(false));
+ // detects multiple elements correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).hasSingleElement(), Matchers.is(false));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -993,16 +1087,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasMultipleElement_succeedingValidationWithMultipleElements() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // detects multiple elements correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).hasMultipleElements(), Matchers.is(true));
+ // detects multiple elements correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).hasMultipleElements(), Matchers.is(true));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1010,16 +1106,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasMultipleElement_succeedingValidationWithEmptyList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects empty results correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(new ArrayList()).hasMultipleElements(), Matchers.is(false));
+ // detects empty results correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(new ArrayList()).hasMultipleElements(), Matchers.is(false));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1027,16 +1125,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasMultipleElement_failingValidationWithListOfSizeOne() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // detects single result elements correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(convertToList(element)).hasMultipleElements(), Matchers.is(false));
+ // detects single result elements correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(convertToList(element)).hasMultipleElements(), Matchers.is(false));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1044,16 +1144,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasMultipleElement_failingValidationWithNullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects single result elements correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).hasMultipleElements(), Matchers.is(false));
+ // detects single result elements correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).hasMultipleElements(), Matchers.is(false));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1061,15 +1163,17 @@ protected void testCase(TypeElement element) {
@Test
public void hasSize_succeedingValidationWithEmptyElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects empty results correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(new ArrayList()).hasSize(0), Matchers.is(true));
+ // detects empty results correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(new ArrayList()).hasSize(0), Matchers.is(true));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1077,15 +1181,17 @@ protected void testCase(TypeElement element) {
@Test
public void hasSize_succeedingValidationWithElementListOfSizeOne() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // detects single result elements correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(convertToList(element)).hasSize(1), Matchers.is(true));
- }
- })
+ // detects single result elements correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(convertToList(element)).hasSize(1), Matchers.is(true));
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1093,15 +1199,17 @@ protected void testCase(TypeElement element) {
@Test
public void hasSize_succeedingValidationWithElementListOfSizeBiggerThanOne() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects multiple elements correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).hasSize(element.getEnclosedElements().size()), Matchers.is(true));
+ // detects multiple elements correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).hasSize(element.getEnclosedElements().size()), Matchers.is(true));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1109,15 +1217,17 @@ protected void testCase(TypeElement element) {
@Test
public void hasSize_succeedingValidationWithNullValued() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects null valued element list correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).hasSize(3), Matchers.is(false));
+ // detects null valued element list correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).hasSize(3), Matchers.is(false));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1125,16 +1235,18 @@ protected void testCase(TypeElement element) {
@Test
public void hasSize_failingValidation1() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- // detects empty results correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).hasSize(0), Matchers.is(false));
+ // detects empty results correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).hasSize(0), Matchers.is(false));
- }
- })
+
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1142,16 +1254,18 @@ protected void testCase(TypeElement element) {
@Test
public void geResultSize_nullValuedElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects empty results correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).getResultSize(), Matchers.is(0));
+ // detects empty results correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter((List) null).getResultSize(), Matchers.is(0));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
@@ -1160,16 +1274,18 @@ protected void testCase(TypeElement element) {
@Test
public void geResultSize_emptyElementList() {
- unitTestBuilder.useProcessor(new AbstractUnitTestAnnotationProcessorClass() {
- @Override
- protected void testCase(TypeElement element) {
+ unitTestBuilder.defineTest(
+ new APTKUnitTestProcessor() {
+ @Override
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
- // detects empty results correctly
- MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).getResultSize(), Matchers.is(element.getEnclosedElements().size()));
+ // detects empty results correctly
+ MatcherAssert.assertThat(FluentElementFilter.createFluentElementFilter(element.getEnclosedElements()).getResultSize(), Matchers.is(element.getEnclosedElements().size()));
- }
- })
+ }
+ })
.compilationShouldSucceed()
.executeTest();
}
diff --git a/tools/src/test/java/io/toolisticon/aptk/tools/InterfaceUtilsTest.java b/tools/src/test/java/io/toolisticon/aptk/tools/InterfaceUtilsTest.java
index a70e50cf..42f5ccb0 100644
--- a/tools/src/test/java/io/toolisticon/aptk/tools/InterfaceUtilsTest.java
+++ b/tools/src/test/java/io/toolisticon/aptk/tools/InterfaceUtilsTest.java
@@ -1,9 +1,11 @@
package io.toolisticon.aptk.tools;
import io.toolisticon.aptk.common.ToolingProvider;
+import io.toolisticon.aptk.cute.APTKUnitTestProcessor;
import io.toolisticon.aptk.tools.wrapper.ExecutableElementWrapper;
import io.toolisticon.aptk.tools.wrapper.TypeElementWrapper;
import io.toolisticon.cute.CompileTestBuilder;
+import io.toolisticon.cute.CompileTestBuilderApi;
import io.toolisticon.cute.PassIn;
import io.toolisticon.cute.UnitTest;
import org.hamcrest.MatcherAssert;
@@ -11,7 +13,6 @@
import org.junit.Test;
import javax.annotation.processing.ProcessingEnvironment;
-import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import java.io.IOException;
@@ -72,9 +73,10 @@ static class TypeVarReplacement {
@Test
public void getStringRepresentationWithReplaceTypeVars() {
- CompileTestBuilder.unitTest().defineTestWithPassedInElement(TypeVarReplacement.class, new UnitTest() {
+ CompileTestBuilder.unitTest().defineTestWithPassedInElement(TypeVarReplacement.class, new APTKUnitTestProcessor() {
@Override
- public void unitTest(ProcessingEnvironment processingEnvironment, VariableElement element) {
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, VariableElement element) {
+
ToolingProvider.setTooling(processingEnvironment);
try {
@@ -108,9 +110,10 @@ static class TypeVarMappingTest {
@Test
public void mapTypeVars_withPassedInTypes() {
- CompileTestBuilder.unitTest().defineTestWithPassedInElement(TypeVarMappingTest.class, new UnitTest() {
+ CompileTestBuilder.unitTest().defineTestWithPassedInElement(TypeVarMappingTest.class, new APTKUnitTestProcessor() {
@Override
- public void unitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
ToolingProvider.setTooling(processingEnvironment);
try {
@@ -133,9 +136,10 @@ public void unitTest(ProcessingEnvironment processingEnvironment, TypeElement el
@Test
public void mapTypeVars_withoutPassedInTypes() {
- CompileTestBuilder.unitTest().defineTestWithPassedInElement(TypeVarMappingTest.class, new UnitTest() {
+ CompileTestBuilder.unitTest().defineTestWithPassedInElement(TypeVarMappingTest.class, new APTKUnitTestProcessor() {
@Override
- public void unitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
+
ToolingProvider.setTooling(processingEnvironment);
try {
@@ -188,28 +192,22 @@ interface MethodsToImplement_Top {
@Test
public void getMethodsToImplement() {
- CompileTestBuilder.unitTest().defineTestWithPassedInElement(MethodsToImplement_Base.class, new UnitTest() {
+ CompileTestBuilder.unitTest().defineTestWithPassedInElement(MethodsToImplement_Base.class, new APTKUnitTestProcessor() {
@Override
- public void unitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
-
- ToolingProvider.setTooling(processingEnvironment);
- try {
+ public void aptkUnitTest(ProcessingEnvironment processingEnvironment, TypeElement element) {
- Set methods = InterfaceUtils.getMethodsToImplement(TypeElementWrapper.wrap(element));
- MatcherAssert.assertThat(methods.stream().map(e -> e.getMethodSignature()).collect(Collectors.toList()), Matchers.containsInAnyOrder(
- "T groundLevel(F baseParam)",
- "String midLevel(Integer midParam)",
- "String topLevel(String topParam)",
- "void withGenerics(List extends String> genParam)",
- "> void withMethodTypeVar(K param)",
- "String withMethodTypeVar() throws IOException",
- "void doubledMethod(String parameter)"));
+ Set methods = InterfaceUtils.getMethodsToImplement(TypeElementWrapper.wrap(element));
+ MatcherAssert.assertThat(methods.stream().map(e -> e.getMethodSignature()).collect(Collectors.toList()), Matchers.containsInAnyOrder(
+ "T groundLevel(F baseParam)",
+ "String midLevel(Integer midParam)",
+ "String topLevel(String topParam)",
+ "void withGenerics(List extends String> genParam)",
+ "> void withMethodTypeVar(K param)",
+ "String withMethodTypeVar() throws IOException",
+ "void doubledMethod(String parameter)"));
- } finally {
- ToolingProvider.clearTooling();
- }
}
})
@@ -244,7 +242,7 @@ public void unitTest(ProcessingEnvironment processingEnvironment, TypeElement el
}
- CompileTestBuilder.UnitTestBuilder unitTestBuilder;
+ CompileTestBuilderApi.UnitTestBuilder unitTestBuilder;
public interface FluentApiConverter