Search in sources :

Example 11 with StorIOContentResolverProcessor

use of com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor in project storio by pushtorefresh.

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileWithMethodsReturningPrimitivesAndConstructorAsCreator.

@Test
public void shouldCompileWithMethodsReturningPrimitivesAndConstructorAsCreator() {
    JavaFileObject model = JavaFileObjects.forResource("PrimitiveMethodsConstructor.java");
    JavaFileObject generatedTypeMapping = JavaFileObjects.forResource("PrimitiveMethodsConstructorContentResolverTypeMapping.java");
    JavaFileObject generatedDeleteResolver = JavaFileObjects.forResource("PrimitiveMethodsConstructorStorIOContentResolverDeleteResolver.java");
    JavaFileObject generatedGetResolver = JavaFileObjects.forResource("PrimitiveMethodsConstructorStorIOContentResolverGetResolver.java");
    JavaFileObject generatedPutResolver = JavaFileObjects.forResource("PrimitiveMethodsConstructorStorIOContentResolverPutResolver.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).compilesWithoutError().and().generatesSources(generatedTypeMapping, generatedDeleteResolver, generatedGetResolver, generatedPutResolver);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 12 with StorIOContentResolverProcessor

use of com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor in project storio by pushtorefresh.

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileWithBoxedTypesFields.

@Test
public void shouldCompileWithBoxedTypesFields() {
    JavaFileObject model = JavaFileObjects.forResource("BoxedTypesFields.java");
    JavaFileObject generatedTypeMapping = JavaFileObjects.forResource("BoxedTypesFieldsContentResolverTypeMapping.java");
    JavaFileObject generatedDeleteResolver = JavaFileObjects.forResource("BoxedTypesFieldsStorIOContentResolverDeleteResolver.java");
    JavaFileObject generatedGetResolver = JavaFileObjects.forResource("BoxedTypesFieldsStorIOContentResolverGetResolver.java");
    JavaFileObject generatedPutResolver = JavaFileObjects.forResource("BoxedTypesFieldsStorIOContentResolverPutResolver.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).compilesWithoutError().and().generatesSources(generatedTypeMapping, generatedDeleteResolver, generatedGetResolver, generatedPutResolver);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 13 with StorIOContentResolverProcessor

use of com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor in project storio by pushtorefresh.

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfCreatorMethodReturnsDifferentType.

@Test
public void shouldNotCompileIfCreatorMethodReturnsDifferentType() {
    JavaFileObject model = JavaFileObjects.forResource("CreatorMethodWithDifferentReturnType.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("StorIOContentResolverCreator can not be applied to method with return type different " + "from CreatorMethodWithDifferentReturnType");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 14 with StorIOContentResolverProcessor

use of com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor in project storio by pushtorefresh.

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfAnnotatedMethodHasParameters.

@Test
public void shouldNotCompileIfAnnotatedMethodHasParameters() {
    JavaFileObject model = JavaFileObjects.forResource("MethodWithParameters.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("StorIOContentResolverColumn can not be applied to method with parameters: id");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 15 with StorIOContentResolverProcessor

use of com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor in project storio by pushtorefresh.

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfClassContainsBothAnnotatedFieldsAndMethods.

@Test
public void shouldNotCompileIfClassContainsBothAnnotatedFieldsAndMethods() {
    JavaFileObject model = JavaFileObjects.forResource("MixedFieldsAndMethods.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("Can't apply StorIOContentResolverColumn annotation to both fields and methods in a same class: MixedFieldsAndMethods");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Aggregations

StorIOContentResolverProcessor (com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor)38 JavaFileObject (javax.tools.JavaFileObject)38 Test (org.junit.Test)38