Search in sources :

Example 36 with JavaFileObject

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

the class EpoxyProcessorTest method testModelWithFieldAnnotation.

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

Example 37 with JavaFileObject

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

the class EpoxyProcessorTest method testModelWithAbstractClassAndAnnotation.

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

Example 38 with JavaFileObject

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

the class EpoxyProcessorTest method testModelWithHolderGeneratesNewHolderMethod.

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

Example 39 with JavaFileObject

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

the class EpoxyProcessorTest method testGeneratedDefaultMethodWithLayoutFailsIfNotSpecifiedInParent.

@Test
public void testGeneratedDefaultMethodWithLayoutFailsIfNotSpecifiedInParent() {
    JavaFileObject model = JavaFileObjects.forResource("GenerateDefaultLayoutMethodParentStillNoLayout.java");
    assert_().about(javaSource()).that(model).processedWith(new EpoxyProcessor()).failsToCompile().withErrorContaining("Model must specify a valid layout resource");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Test(org.junit.Test)

Example 40 with JavaFileObject

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

the class ConfigTest method testConfigRequireHashCodeIterablePasses.

@Test
public void testConfigRequireHashCodeIterablePasses() {
    JavaFileObject model = forResource("ModelRequiresHashCodeIterableSucceeds.java");
    assert_().about(javaSources()).that(asList(CONFIG_CLASS_REQUIRE_HASH, model)).processedWith(new EpoxyProcessor()).compilesWithoutError();
}
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