Search in sources :

Example 36 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfNotClassAnnotatedWithTypeAnnotations.

@Test
public void shouldNotCompileIfNotClassAnnotatedWithTypeAnnotations() {
    JavaFileObject model = JavaFileObjects.forResource("AnnotatedInterface.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("StorIOContentResolverType can be applied only to classes not to AnnotatedInterface");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 37 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileIfAnnotatedFieldIsPrivateAndHasIsGetter.

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

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfClassContainsMultipleCreators.

@Test
public void shouldNotCompileIfClassContainsMultipleCreators() {
    JavaFileObject model = JavaFileObjects.forResource("MultipleCreators.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("Only one creator method or constructor is allowed: MultipleCreators");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 39 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileWithPrivatePrimitiveFieldsWithCorrepsondingGetters.

@Test
public void shouldCompileWithPrivatePrimitiveFieldsWithCorrepsondingGetters() {
    JavaFileObject model = JavaFileObjects.forResource("PrimitivePrivateFields.java");
    JavaFileObject generatedTypeMapping = JavaFileObjects.forResource("PrimitivePrivateFieldsContentResolverTypeMapping.java");
    JavaFileObject generatedDeleteResolver = JavaFileObjects.forResource("PrimitivePrivateFieldsStorIOContentResolverDeleteResolver.java");
    JavaFileObject generatedGetResolver = JavaFileObjects.forResource("PrimitivePrivateFieldsStorIOContentResolverGetResolver.java");
    JavaFileObject generatedPutResolver = JavaFileObjects.forResource("PrimitivePrivateFieldsStorIOContentResolverPutResolver.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)

Example 40 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfNestedClassAnnotatedWithTypeAnnotation.

@Test
public void shouldNotCompileIfNestedClassAnnotatedWithTypeAnnotation() {
    JavaFileObject model = JavaFileObjects.forResource("NestedClass.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("StorIOContentResolverType can't be applied to nested or inner classes: ActualClass");
}
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