@Test
public void ruleKindDetection() throws Exception {

  createSourceFiles("x/", "x/Binary.java", "x/SomeTest.java", "x/AbstractTest.java");
  Path file1 =
      writeFile(
          workspace.resolve("x/Binary.java"),
          "package com.hello;",
          "class Binary {",
          "  public static void main(String[] args) { }",
          "}");
  Path file2 =
      writeFile(
          workspace.resolve("x/SomeTest.java"),
          "package com.hello;",
          "class SomeTest {",
          "  @org.junit.Test",
          "  void testSomething() {}",
          "}");
  Path file3 =
      writeFile(
          workspace.resolve("x/AbstractTest.java"),
          "package com.hello;",
          "abstract class AbstractTest {",
          "  @org.junit.Test",
          "  abstract void testSomething() {}",
          "}");
  JavaSourceFileParser parser = createParser(file1, file2, file3);
  assertThat(parser.getFilesToRuleKind())
      .containsExactly(
          // Binary.java has a static method named 'main' with a single String[] parameter.
          "/src/x/Binary.java",
          "java_binary",
          "/src/x/SomeTest.java",
          "java_test",
          // AbstractTest is abstract, so must be a java_library.
          "/src/x/AbstractTest.java",
          "java_library");
}