DevResourcesScanner implements ResourcesScanner { @Override public List<Path> scan(Path pluginDirectory) throws PluginException { Path resourcesPath = pluginDirectory.resolve("src").resolve("main").resolve("resources"); if (Files.exists(resourcesPath) && Files.isDirectory(resourcesPath)) { try { return PluginUtils.getMatchingFiles(resourcesPath, patterns); } catch (IOException e) { throw new PluginException(e); } } return Collections.emptyList(); } DevResourcesScanner(String[] patterns); @Override List<Path> scan(Path pluginDirectory);  }
@Test public void testScan() throws Exception { createFiles(); Path pluginDirectory = temporaryDirectory.getDirectory(); DevResourcesScanner devResourcesScanner = new DevResourcesScanner(GLOBS); List<Path> matchingResources = devResourcesScanner.scan(pluginDirectory); assertThat(matchingResources, hasSize(1)); assertThat(matchingResources, hasItem(matchingFile)); }
@Test public void testResourcesDirectoryMissing() throws PluginException { Path pluginDirectory = temporaryDirectory.getDirectory(); DevResourcesScanner devResourcesScanner = new DevResourcesScanner(GLOBS); List<Path> matchingResources = devResourcesScanner.scan(pluginDirectory); assertThat(matchingResources, hasSize(0)); }