Search in sources :

Example 21 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldCompileWithMethodsReturningPrimitivesAndFactoryMethodAsCreator.

@Test
public void shouldCompileWithMethodsReturningPrimitivesAndFactoryMethodAsCreator() {
    JavaFileObject model = JavaFileObjects.forResource("PrimitiveMethodsFactoryMethod.java");
    JavaFileObject generatedTypeMapping = JavaFileObjects.forResource("PrimitiveMethodsFactoryMethodContentResolverTypeMapping.java");
    JavaFileObject generatedDeleteResolver = JavaFileObjects.forResource("PrimitiveMethodsFactoryMethodStorIOContentResolverDeleteResolver.java");
    JavaFileObject generatedGetResolver = JavaFileObjects.forResource("PrimitiveMethodsFactoryMethodStorIOContentResolverGetResolver.java");
    JavaFileObject generatedPutResolver = JavaFileObjects.forResource("PrimitiveMethodsFactoryMethodStorIOContentResolverPutResolver.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 22 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfAnnotatedMethodIsPrivate.

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

Example 23 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileWithFinalFieldAndWithoutCreator.

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

Example 24 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfClassIsEmpty.

@Test
public void shouldNotCompileIfClassIsEmpty() {
    JavaFileObject model = JavaFileObjects.forResource("EmptyClass.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("Class marked with StorIOContentResolverType annotation should have at least one field or method marked with " + "StorIOContentResolverColumn annotation: EmptyClass");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOContentResolverProcessor(com.pushtorefresh.storio3.contentresolver.annotations.processor.StorIOContentResolverProcessor) Test(org.junit.Test)

Example 25 with StorIOContentResolverProcessor

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

the class StorIOContentResolverAnnotationsProcessorTest method shouldNotCompileIfThereIsAColumnWithSameName.

@Test
public void shouldNotCompileIfThereIsAColumnWithSameName() {
    JavaFileObject model = JavaFileObjects.forResource("SameColumnName.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOContentResolverProcessor()).failsToCompile().withErrorContaining("Column name already used in this class: id");
}
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