Search in sources :

Example 21 with StorIOSQLiteProcessor

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

the class StorIOSQLiteAnnotationsProcessorTest method shouldNotCompileIfColumnNameIsEmpty.

@Test
public void shouldNotCompileIfColumnNameIsEmpty() {
    JavaFileObject model = JavaFileObjects.forResource("EmptyColumnName.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOSQLiteProcessor()).failsToCompile().withErrorContaining("Column name is empty: id");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOSQLiteProcessor(com.pushtorefresh.storio.sqlite.annotations.processor.StorIOSQLiteProcessor) Test(org.junit.Test)

Example 22 with StorIOSQLiteProcessor

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

the class StorIOSQLiteAnnotationsProcessorTest method shouldCompileWithPrimitiveFields.

@Test
public void shouldCompileWithPrimitiveFields() {
    JavaFileObject model = JavaFileObjects.forResource("PrimitiveFields.java");
    JavaFileObject generatedTypeMapping = JavaFileObjects.forResource("PrimitiveFieldsSQLiteTypeMapping.java");
    JavaFileObject generatedDeleteResolver = JavaFileObjects.forResource("PrimitiveFieldsStorIOSQLiteDeleteResolver.java");
    JavaFileObject generatedGetResolver = JavaFileObjects.forResource("PrimitiveFieldsStorIOSQLiteGetResolver.java");
    JavaFileObject generatedPutResolver = JavaFileObjects.forResource("PrimitiveFieldsStorIOSQLitePutResolver.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.storio.sqlite.annotations.processor.StorIOSQLiteProcessor) Test(org.junit.Test)

Example 23 with StorIOSQLiteProcessor

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

the class StorIOSQLiteAnnotationsProcessorTest method shouldNotCompileIfClassDoesNotHaveKey.

@Test
public void shouldNotCompileIfClassDoesNotHaveKey() {
    JavaFileObject model = JavaFileObjects.forResource("NoKey.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOSQLiteProcessor()).failsToCompile().withErrorContaining("Class marked with StorIOSQLiteType annotation should have at least one KEY field or method marked with " + "StorIOSQLiteColumn annotation: NoKey");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOSQLiteProcessor(com.pushtorefresh.storio.sqlite.annotations.processor.StorIOSQLiteProcessor) Test(org.junit.Test)

Example 24 with StorIOSQLiteProcessor

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

the class StorIOSQLiteAnnotationsProcessorTest method shouldNotCompileIfClassContainsMultipleCreators.

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

Example 25 with StorIOSQLiteProcessor

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

the class StorIOSQLiteAnnotationsProcessorTest method shouldNotCompileIfClassNeedsCreatorAndDoesNotHaveOne.

@Test
public void shouldNotCompileIfClassNeedsCreatorAndDoesNotHaveOne() {
    JavaFileObject model = JavaFileObjects.forResource("NoCreator.java");
    assert_().about(javaSource()).that(model).processedWith(new StorIOSQLiteProcessor()).failsToCompile().withErrorContaining("Class marked with StorIOSQLiteType annotation needs factory method or constructor marked with " + "StorIOSQLiteCreator annotation: NoCreator");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) StorIOSQLiteProcessor(com.pushtorefresh.storio.sqlite.annotations.processor.StorIOSQLiteProcessor) Test(org.junit.Test)

Aggregations

StorIOSQLiteProcessor (com.pushtorefresh.storio.sqlite.annotations.processor.StorIOSQLiteProcessor)35 JavaFileObject (javax.tools.JavaFileObject)35 Test (org.junit.Test)35