FrontendToolsLocator implements Serializable { public boolean verifyTool(File toolPath) { return Optional.ofNullable(toolPath).filter(File::isFile) .map(File::getAbsolutePath) .flatMap(path -> executeCommand(true, path, "-v")) .map(this::omitErrorResult).isPresent(); }  Optional<File> tryLocateTool(String toolName); boolean verifyTool(File toolPath);  }
@Test public void nonExistentTool_notVerified() { assertFalse("Non-existent tool should not be a valid one", locator.verifyTool(new File("whatever!"))); }