Search in sources :

Example 16 with StorIOSQLiteProcessor

use of com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor in project storio by pushtorefresh.

the class StorIOSQLiteAnnotationsProcessorTest method shouldNotCompileIfCreatorMethodIsNotStatic.

@Test
public void shouldNotCompileIfCreatorMethodIsNotStatic() {
    JavaFileObject model = JavaFileObjects.forResource("NonStaticCreatorMethod.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOSQLiteProcessor()).failsToCompile().withErrorContaining("StorIOSQLiteCreator can not be applied to non-static methods: creator");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOSQLiteProcessor(com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor) Test(org.junit.Test)

Example 17 with StorIOSQLiteProcessor

use of com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor in project storio by pushtorefresh.

the class StorIOSQLiteAnnotationsProcessorTest method shouldNotCompileIfAnnotatedFieldIsPrivateAndDoesNotHaveGetter.

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

Example 18 with StorIOSQLiteProcessor

use of com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor in project storio by pushtorefresh.

the class StorIOSQLiteAnnotationsProcessorTest method shouldNotCompileIfNoArgConstructorIsAbsent.

@Test
public void shouldNotCompileIfNoArgConstructorIsAbsent() {
    JavaFileObject model = JavaFileObjects.forResource("AbsenceOfNoArgConstructor.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOSQLiteProcessor()).failsToCompile().withErrorContaining("constructor AbsenceOfNoArgConstructor in class com.pushtorefresh.storio3.sqlite.annotations.AbsenceOfNoArgConstructor" + " cannot be applied to given types;\n" + "  required: long\n" + "  found: no arguments\n" + "  reason: actual and formal argument lists differ in length");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOSQLiteProcessor(com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor) Test(org.junit.Test)

Example 19 with StorIOSQLiteProcessor

use of com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor in project storio by pushtorefresh.

the class StorIOSQLiteAnnotationsProcessorTest method shouldNotCompileIfClassContainsBothAnnotatedFieldsAndMethods.

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

Example 20 with StorIOSQLiteProcessor

use of com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor in project storio by pushtorefresh.

the class StorIOSQLiteAnnotationsProcessorTest method shouldCompileWithBoxedTypesFields.

@Test
public void shouldCompileWithBoxedTypesFields() {
    JavaFileObject model = JavaFileObjects.forResource("BoxedTypesFields.java");
    JavaFileObject generatedTypeMapping = JavaFileObjects.forResource("BoxedTypesFieldsSQLiteTypeMapping.java");
    JavaFileObject generatedDeleteResolver = JavaFileObjects.forResource("BoxedTypesFieldsStorIOSQLiteDeleteResolver.java");
    JavaFileObject generatedGetResolver = JavaFileObjects.forResource("BoxedTypesFieldsStorIOSQLiteGetResolver.java");
    JavaFileObject generatedPutResolver = JavaFileObjects.forResource("BoxedTypesFieldsStorIOSQLitePutResolver.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOSQLiteProcessor()).compilesWithoutError().and().generatesSources(generatedTypeMapping, generatedDeleteResolver, generatedGetResolver, generatedPutResolver);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOSQLiteProcessor(com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor) Test(org.junit.Test)

Aggregations

StorIOSQLiteProcessor (com.pushtorefresh.storio3.sqlite.annotations.processor.StorIOSQLiteProcessor)47 JavaFileObject (javax.tools.JavaFileObject)47 Test (org.junit.Test)47