GroovyFileSystem { @CheckForNull public InputFile sourceInputFileFromRelativePath(String relativePath) { return fileSystem.inputFile(predicates.and(predicates.matchesPathPattern("**/" + relativePath), isGroovyLanguage, isMainTypeFile)); } GroovyFileSystem(FileSystem fileSystem); boolean hasGroovyFiles(); List<File> sourceFiles(); List<InputFile> groovyInputFiles(); List<InputFile> sourceInputFiles(); @CheckForNull InputFile sourceInputFileFromRelativePath(String relativePath); File baseDir();  }
@Test public void inputFileFromRelativePath() { assertThat(groovyFileSystem.sourceInputFileFromRelativePath(null)).isNull(); fileSystem.add(new DefaultInputFile("", "fake1.file")); assertThat(groovyFileSystem.sourceInputFileFromRelativePath("fake1.file")).isNull(); fileSystem.add(new DefaultInputFile("", "fake2.file").setType(Type.MAIN).setLanguage(Groovy.KEY)); assertThat(groovyFileSystem.sourceInputFileFromRelativePath("fake2.file")).isNotNull(); fileSystem.add(new DefaultInputFile("", "org/sample/foo/fake3.file").setType(Type.MAIN).setLanguage(Groovy.KEY)); assertThat(groovyFileSystem.sourceInputFileFromRelativePath("foo/fake3.file")).isNotNull(); }