// Path: compiler/src/test/java/com/contentful/vault/compiler/lib/TestUtils.java
// public static Iterable<? extends Processor> processors() {
//   return Arrays.asList(new Processor());
// }
// 
// Path: compiler/src/test/java/com/contentful/vault/compiler/lib/TestUtils.java
// public static String readTestResource(String fileName) throws IOException {
//   URL resource = TestUtils.class.getClassLoader().getResource(fileName);
//   return FileUtils.readFileToString(new File(resource.getPath()), Charset.defaultCharset());
// }


import com.google.common.base.Joiner;
import com.google.testing.compile.JavaFileObjects;
import org.junit.Test;
import javax.tools.JavaFileObject;
import static com.contentful.vault.compiler.lib.TestUtils.processors;
import static com.contentful.vault.compiler.lib.TestUtils.readTestResource;
import static com.google.common.truth.Truth.assert_;
import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource;
        .and()
        .generatesSources(expectedSource);
  }

  @Test public void failsEmptyId() throws Exception {
    JavaFileObject source = JavaFileObjects.forSourceString("Test",
        Joiner.on('\n').join(
            "import com.contentful.vault.ContentType;",
            "import com.contentful.vault.Resource;",
            "@ContentType(\"\")",
            "class Test extends Resource {",
            "}"
        ));

    assert_().about(javaSource()).that(source)
        .processedWith(processors())
        .failsToCompile()
        .withErrorContaining("@ContentType id may not be empty. (Test)");
  }

  @Test public void failsInvalidType() throws Exception {
    JavaFileObject source = JavaFileObjects.forSourceString("Test", Joiner.on('\n').join(
        "import com.contentful.vault.ContentType;",
        "import java.util.Date;",
        "@ContentType(\"cid\")",
        "class Test {",
        "}"));

    assert_().about(javaSource()).that(source)
        .processedWith(processors())
// Path: compiler/src/test/java/com/contentful/vault/compiler/lib/TestUtils.java
// public static Iterable<? extends Processor> processors() {
//   return Arrays.asList(new Processor());
// }
// 
// Path: compiler/src/test/java/com/contentful/vault/compiler/lib/TestUtils.java
// public static String readTestResource(String fileName) throws IOException {
//   URL resource = TestUtils.class.getClassLoader().getResource(fileName);
//   return FileUtils.readFileToString(new File(resource.getPath()), Charset.defaultCharset());
// }


// Path: compiler/src/test/java/com/contentful/vault/compiler/ContentTypeTest.java
import com.google.common.base.Joiner;
import com.google.testing.compile.JavaFileObjects;
import org.junit.Test;
import javax.tools.JavaFileObject;
import static com.contentful.vault.compiler.lib.TestUtils.processors;
import static com.contentful.vault.compiler.lib.TestUtils.readTestResource;
import static com.google.common.truth.Truth.assert_;
import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource;

        .and()
        .generatesSources(expectedSource);
  }

  @Test public void failsEmptyId() throws Exception {
    JavaFileObject source = JavaFileObjects.forSourceString("Test",
        Joiner.on('\n').join(
            "import com.contentful.vault.ContentType;",
            "import com.contentful.vault.Resource;",
            "@ContentType(\"\")",
            "class Test extends Resource {",
            "}"
        ));

    assert_().about(javaSource()).that(source)
        .processedWith(processors())
        .failsToCompile()
        .withErrorContaining("@ContentType id may not be empty. (Test)");
  }

  @Test public void failsInvalidType() throws Exception {
    JavaFileObject source = JavaFileObjects.forSourceString("Test", Joiner.on('\n').join(
        "import com.contentful.vault.ContentType;",
        "import java.util.Date;",
        "@ContentType(\"cid\")",
        "class Test {",
        "}"));

    assert_().about(javaSource()).that(source)
        .processedWith(processors())
        .failsToCompile()