DefaultJavaResourceLocator implements JavaResourceLocator { @Override public InputFile findResourceByClassName(String className) { String name = className.replace('.', '/'); InputFile inputFile = resourcesByClass.get(name); if (inputFile == null) { LOG.debug("Class not found in resource cache : {}", className); } return inputFile; } DefaultJavaResourceLocator(JavaClasspath javaClasspath); @Override InputFile findResourceByClassName(String className); @Override Collection<File> classFilesToAnalyze(); @Override Collection<File> classpath(); @Override void scanFile(JavaFileScannerContext context);  }
@Test void resource_by_class_name() throws Exception { assertThat(javaResourceLocator.findResourceByClassName("org.sonar.java.DefaultJavaResourceLocatorTest")).isNotNull(); assertThat(javaResourceLocator.findResourceByClassName("org.sonar.java.DumbClassName")).isNull(); }