@Test public void unavailableFoldersAreNotStoredInDiscoveryRequest() throws Exception { // @formatter:off TestDiscoveryRequest discoveryRequest = request().select(ClasspathSelector.forPath("/some/local/path")).build(); // @formatter:on List<String> folders = discoveryRequest .getSelectorsByType(ClasspathSelector.class) .stream() .map(ClasspathSelector::getClasspathRoot) .map(File::getAbsolutePath) .collect(toList()); assertThat(folders).isEmpty(); }
@Test public void availableFoldersAreStoredInDiscoveryRequest() throws Exception { File temporaryFolder = Files.newTemporaryFolder(); try { // @formatter:off TestDiscoveryRequest discoveryRequest = request().select(ClasspathSelector.forPath(temporaryFolder.getAbsolutePath())).build(); // @formatter:on List<String> folders = discoveryRequest .getSelectorsByType(ClasspathSelector.class) .stream() .map(ClasspathSelector::getClasspathRoot) .map(File::getAbsolutePath) .collect(toList()); assertThat(folders).contains(temporaryFolder.getAbsolutePath()); } finally { temporaryFolder.delete(); } }