Search in sources :

Example 31 with JavaFileObject

use of javax.tools.JavaFileObject in project epoxy by airbnb.

the class EpoxyProcessorTest method testModelWithFinalAttribute.

@Test
public void testModelWithFinalAttribute() {
    JavaFileObject model = JavaFileObjects.forResource("ModelWithFinalField.java");
    JavaFileObject generatedModel = JavaFileObjects.forResource("ModelWithFinalField_.java");
    assert_().about(javaSource()).that(model).processedWith(new EpoxyProcessor()).compilesWithoutError().and().generatesSources(generatedModel);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Test(org.junit.Test)

Example 32 with JavaFileObject

use of javax.tools.JavaFileObject in project epoxy by airbnb.

the class EpoxyProcessorTest method testModelAsInnerClassFails.

@Test
public void testModelAsInnerClassFails() {
    JavaFileObject model = JavaFileObjects.forResource("ModelAsInnerClass.java");
    assert_().about(javaSource()).that(model).processedWith(new EpoxyProcessor()).failsToCompile().withErrorContaining("Nested classes");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Test(org.junit.Test)

Example 33 with JavaFileObject

use of javax.tools.JavaFileObject in project epoxy by airbnb.

the class EpoxyProcessorTest method testModelWithAnnotatedClass.

@Test
public void testModelWithAnnotatedClass() {
    JavaFileObject model = JavaFileObjects.forResource("ModelWithAnnotatedClass.java");
    JavaFileObject generatedModel = JavaFileObjects.forResource("ModelWithAnnotatedClass_.java");
    assert_().about(javaSource()).that(model).processedWith(new EpoxyProcessor()).compilesWithoutError().and().generatesSources(generatedModel);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Test(org.junit.Test)

Example 34 with JavaFileObject

use of javax.tools.JavaFileObject in project epoxy by airbnb.

the class EpoxyProcessorTest method testGeneratedDefaultMethodWithLayoutSpecifiedInNextParent.

@Test
public void testGeneratedDefaultMethodWithLayoutSpecifiedInNextParent() {
    JavaFileObject model = JavaFileObjects.forResource("GenerateDefaultLayoutMethodNextParentLayout.java");
    JavaFileObject generatedNoLayoutModel = JavaFileObjects.forResource("GenerateDefaultLayoutMethodNextParentLayout$NoLayout.java");
    JavaFileObject generatedStillNoLayoutModel = JavaFileObjects.forResource("GenerateDefaultLayoutMethodNextParentLayout$StillNoLayout.java");
    JavaFileObject generatedWithLayoutModel = JavaFileObjects.forResource("GenerateDefaultLayoutMethodNextParentLayout$WithLayout.java");
    assert_().about(javaSource()).that(model).processedWith(new EpoxyProcessor()).compilesWithoutError().and().generatesSources(generatedNoLayoutModel, generatedStillNoLayoutModel, generatedWithLayoutModel);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Test(org.junit.Test)

Example 35 with JavaFileObject

use of javax.tools.JavaFileObject in project epoxy by airbnb.

the class EpoxyProcessorTest method testModelReturningClassTypeWithVarargs.

@Test
public void testModelReturningClassTypeWithVarargs() {
    JavaFileObject model = JavaFileObjects.forResource("ModelReturningClassTypeWithVarargs.java");
    JavaFileObject generatedModel = JavaFileObjects.forResource("ModelReturningClassTypeWithVarargs_.java");
    assert_().about(javaSource()).that(model).processedWith(new EpoxyProcessor()).compilesWithoutError().and().generatesSources(generatedModel);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Test(org.junit.Test)

Aggregations

JavaFileObject (javax.tools.JavaFileObject)663 Test (org.junit.Test)473 ButterKnifeProcessor (butterknife.compiler.ButterKnifeProcessor)121 IOException (java.io.IOException)52 JavaCompiler (javax.tools.JavaCompiler)40 StorIOContentResolverProcessor (com.pushtorefresh.storio.contentresolver.annotations.processor.StorIOContentResolverProcessor)38 StorIOSQLiteProcessor (com.pushtorefresh.storio.sqlite.annotations.processor.StorIOSQLiteProcessor)35 File (java.io.File)32 Diagnostic (javax.tools.Diagnostic)30 DiagnosticCollector (javax.tools.DiagnosticCollector)28 SimpleJavaFileObject (javax.tools.SimpleJavaFileObject)25 StandardJavaFileManager (javax.tools.StandardJavaFileManager)25 ArrayList (java.util.ArrayList)24 TypeElement (javax.lang.model.element.TypeElement)21 Result (com.sun.tools.javac.main.Main.Result)20 Writer (java.io.Writer)17 PrintWriter (java.io.PrintWriter)16 CompilationTask (javax.tools.JavaCompiler.CompilationTask)14 JCTree (com.sun.tools.javac.tree.JCTree)10 StringWriter (java.io.StringWriter)10