JavaSourceFileParser { public ImmutableMap<String, String> getFilesToRuleKind() { return filesToRuleKind; } JavaSourceFileParser(
      ImmutableList<Path> sourceFilePaths,
      ImmutableList<Path> contentRoots,
      ImmutableSet<Path> oneRulePerPackageRoots); ImmutableMap<String, String> getClassToFile(); ImmutableMap<String, String> getFilesToRuleKind();  }
@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( "/src/x/Binary.java", "java_binary", "/src/x/SomeTest.java", "java_test", "/src/x/AbstractTest.java", "java_library"); }