Search in sources :

Example 41 with JavaFileObject

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

the class ConfigTest method testConfigRequireHashCodeArrayPasses.

@Test
public void testConfigRequireHashCodeArrayPasses() {
    JavaFileObject model = forResource("ModelRequiresHashCodeArraySucceeds.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)

Example 42 with JavaFileObject

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

the class ConfigTest method testConfigRequireHashCodeInterfaceWithHashCodePasses.

@Test
public void testConfigRequireHashCodeInterfaceWithHashCodePasses() {
    // Verify that AutoValue class attributes pass the hashcode requirement
    JavaFileObject model = forResource("ModelConfigRequireHashCodeInterfaceWithHashCodePasses.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)

Example 43 with JavaFileObject

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

the class ConfigTest method testConfigRequireHashCodeArrayFails.

@Test
public void testConfigRequireHashCodeArrayFails() {
    JavaFileObject model = forResource("ModelRequiresHashCodeArrayFails.java");
    assert_().about(javaSources()).that(asList(CONFIG_CLASS_REQUIRE_HASH, model)).processedWith(new EpoxyProcessor()).failsToCompile().withErrorContaining("Type in array does not implement hashCode");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Test(org.junit.Test)

Example 44 with JavaFileObject

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

the class ConfigTest method testConfigRequireAbstractModelFailsEpoxyModelClass.

@Test
public void testConfigRequireAbstractModelFailsEpoxyModelClass() {
    // Verify that AutoValue class attributes pass the hashcode requirement
    JavaFileObject model = forResource("RequireAbstractModelFailsEpoxyModelClass.java");
    assert_().about(javaSources()).that(asList(CONFIG_CLASS_REQUIRE_ABSTRACT, model)).processedWith(new EpoxyProcessor()).failsToCompile().withErrorContaining("Epoxy model class must be abstract (RequireAbstractModelFailsEpoxyModelClass)");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Test(org.junit.Test)

Example 45 with JavaFileObject

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

the class ConfigTest method testSubPackageOverridesParent.

@Test
public void testSubPackageOverridesParent() {
    JavaFileObject subPackageConfig = JavaFileObjects.forSourceString("com.airbnb.epoxy.configtest.sub.package-info", "@PackageEpoxyConfig(\n" + "    requireHashCode = false\n" + ")\n" + "package com.airbnb.epoxy.configtest.sub;\n" + "\n" + "import com.airbnb.epoxy.PackageEpoxyConfig;");
    JavaFileObject model = forResource("ModelConfigSubPackageOverridesParent.java");
    assert_().about(javaSources()).that(asList(CONFIG_CLASS_REQUIRE_HASH, model, subPackageConfig)).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