Search in sources :

Example 41 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfCreatorsArgumentsDoNotMatchWithColumns.

@Test
public void shouldNotCompileIfCreatorsArgumentsDoNotMatchWithColumns() {
    JavaFileObject model = JavaFileObjects.forResource("CreatorWithNotMatchingArguments.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("Class marked with StorIOContentResolverType annotation needs factory method or constructor marked with StorIOContentResolverCreator" + " annotation with parameters matching CreatorWithNotMatchingArguments columns");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 42 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfCreatorInsideNotAnnotatedClass.

@Test
public void shouldNotCompileIfCreatorInsideNotAnnotatedClass() {
    JavaFileObject model = JavaFileObjects.forResource("CreatorInsideNotAnnotatedClass.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("Please annotate class CreatorInsideNotAnnotatedClass with StorIOContentResolverType");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 43 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileWithPrivateFinalFieldWithGetterAndCreator.

@Test
public void shouldCompileWithPrivateFinalFieldWithGetterAndCreator() {
    JavaFileObject model = JavaFileObjects.forResource("PrivateFinalFieldWithGetterAndCreator.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).compilesWithoutError();
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 44 with StorIOContentResolverProcessor

use of com.pushtorefresh.storio3.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.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 45 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileWithMethodsReturningBoxedTypesAndConstructorAsCreator.

@Test
public void shouldCompileWithMethodsReturningBoxedTypesAndConstructorAsCreator() {
    JavaFileObject model = JavaFileObjects.forResource("BoxedTypesMethodsConstructor.java");
    JavaFileObject generatedTypeMapping = JavaFileObjects.forResource("BoxedTypesMethodsConstructorContentResolverTypeMapping.java");
    JavaFileObject generatedDeleteResolver = JavaFileObjects.forResource("BoxedTypesMethodsConstructorStorIOContentResolverDeleteResolver.java");
    JavaFileObject generatedGetResolver = JavaFileObjects.forResource("BoxedTypesMethodsConstructorStorIOContentResolverGetResolver.java");
    JavaFileObject generatedPutResolver = JavaFileObjects.forResource("BoxedTypesMethodsConstructorStorIOContentResolverPutResolver.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.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Aggregations

StorIOContentResolverProcessor (com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor)47 JavaFileObject (javax.tools.JavaFileObject)47 Test (org.junit.Test)47