Search in sources :

Example 11 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfCreatorIsPrivate.

@Test
public void shouldNotCompileIfCreatorIsPrivate() {
    JavaFileObject model = JavaFileObjects.forResource("PrivateCreator.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("StorIOContentResolverCreator can not be applied to private methods or constructors: <init>");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 12 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileIfAnnotatedMethodIsFinal.

@Test
public void shouldCompileIfAnnotatedMethodIsFinal() {
    JavaFileObject model = JavaFileObjects.forResource("FinalMethod.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 13 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfAnnotatedFieldIsPrivateAndDoesNotHaveGetter.

@Test
public void shouldNotCompileIfAnnotatedFieldIsPrivateAndDoesNotHaveGetter() {
    JavaFileObject model = JavaFileObjects.forResource("PrivateFieldWithoutGetter.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("StorIOContentResolverColumn can not be applied to private field without corresponding getter: id");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 14 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileIfAnnotatedFieldIsPrivateAndHasNameStartingWithIs.

@Test
public void shouldCompileIfAnnotatedFieldIsPrivateAndHasNameStartingWithIs() {
    JavaFileObject model = JavaFileObjects.forResource("PrivateFieldWithNameStartingWithIs.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 15 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileWithPrimitiveFields.

@Test
public void shouldCompileWithPrimitiveFields() {
    JavaFileObject model = JavaFileObjects.forResource("PrimitiveFields.java");
    JavaFileObject generatedTypeMapping = JavaFileObjects.forResource("PrimitiveFieldsContentResolverTypeMapping.java");
    JavaFileObject generatedDeleteResolver = JavaFileObjects.forResource("PrimitiveFieldsStorIOContentResolverDeleteResolver.java");
    JavaFileObject generatedGetResolver = JavaFileObjects.forResource("PrimitiveFieldsStorIOContentResolverGetResolver.java");
    JavaFileObject generatedPutResolver = JavaFileObjects.forResource("PrimitiveFieldsStorIOContentResolverPutResolver.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