@Test public void emptyPossibleInstallationDirectoriesAreReturned_whenLocationDoesNotExist() throws Exception { assertThat(PythonInstallationDirectoryFinder.findPossibleInstallationsFor("not_existing_location")).isEmpty(); }
public static List<PythonInstallationDirectory> findPossibleInstallationsFor(final String path) { final File location = new File(path); if (!location.exists() || !location.isDirectory()) { return new ArrayList<>(); } return Stream.of(location.listFiles()) .filter(File::isFile) .flatMap(file -> EnumSet.allOf(SuiteExecutor.class) .stream() .filter(executor -> file.getName().equals(executor.executableName()))) .map(interpreter -> new PythonInstallationDirectory(location.toURI(), interpreter)) .collect(toList()); }
PythonInstallationDirectoryFinder { public static List<PythonInstallationDirectory> findPossibleInstallationsFor(final String path) { final File location = new File(path); if (!location.exists() || !location.isDirectory()) { return new ArrayList<>(); } return Stream.of(location.listFiles()) .filter(File::isFile) .flatMap(file -> EnumSet.allOf(SuiteExecutor.class) .stream() .filter(executor -> file.getName().equals(executor.executableName()))) .map(interpreter -> new PythonInstallationDirectory(location.toURI(), interpreter)) .collect(toList()); } }
PythonInstallationDirectoryFinder { public static List<PythonInstallationDirectory> findPossibleInstallationsFor(final String path) { final File location = new File(path); if (!location.exists() || !location.isDirectory()) { return new ArrayList<>(); } return Stream.of(location.listFiles()) .filter(File::isFile) .flatMap(file -> EnumSet.allOf(SuiteExecutor.class) .stream() .filter(executor -> file.getName().equals(executor.executableName()))) .map(interpreter -> new PythonInstallationDirectory(location.toURI(), interpreter)) .collect(toList()); }  }
PythonInstallationDirectoryFinder { public static List<PythonInstallationDirectory> findPossibleInstallationsFor(final String path) { final File location = new File(path); if (!location.exists() || !location.isDirectory()) { return new ArrayList<>(); } return Stream.of(location.listFiles()) .filter(File::isFile) .flatMap(file -> EnumSet.allOf(SuiteExecutor.class) .stream() .filter(executor -> file.getName().equals(executor.executableName()))) .map(interpreter -> new PythonInstallationDirectory(location.toURI(), interpreter)) .collect(toList()); }  static List<PythonInstallationDirectory> whereArePythonInterpreters(); static Optional<PythonInstallationDirectory> whereIsPythonInterpreter(final SuiteExecutor interpreter); static List<PythonInstallationDirectory> findPossibleInstallationsFor(final String path); }
PythonInstallationDirectoryFinder { public static List<PythonInstallationDirectory> findPossibleInstallationsFor(final String path) { final File location = new File(path); if (!location.exists() || !location.isDirectory()) { return new ArrayList<>(); } return Stream.of(location.listFiles()) .filter(File::isFile) .flatMap(file -> EnumSet.allOf(SuiteExecutor.class) .stream() .filter(executor -> file.getName().equals(executor.executableName()))) .map(interpreter -> new PythonInstallationDirectory(location.toURI(), interpreter)) .collect(toList()); }  static List<PythonInstallationDirectory> whereArePythonInterpreters(); static Optional<PythonInstallationDirectory> whereIsPythonInterpreter(final SuiteExecutor interpreter); static List<PythonInstallationDirectory> findPossibleInstallationsFor(final String path);  }