NomadConfigurationManager { boolean checkDirectoryExists(Path path) { boolean dirExists = path.toFile().exists(); if (dirExists && !Files.isDirectory(path)) { throw new IllegalArgumentException(path.getFileName() + " at path: " + path.getParent() + " is not a directory"); } return dirExists; } NomadConfigurationManager(Path configurationDirectory, IParameterSubstitutor parameterSubstitutor); Optional<String> getNodeName(); void createDirectories(); Path getConfigurationDirectory(); Path getClusterPath(); Path getLicensePath(); Path getChangesPath(); static Optional<String> findNodeName(Path configurationDirectory, IParameterSubstitutor parameterSubstitutor);  }
@Test public void testCheckDirectoryExists() throws Exception { NomadConfigurationManager configManager = new NomadConfigurationManager(configPath, parameterSubstitutor); File newFolder = folder.newFolder(); assertThat(configManager.checkDirectoryExists(newFolder.toPath()), is(true)); File newFile = folder.newFile(); exception.expect(IllegalArgumentException.class); configManager.checkDirectoryExists(newFile.toPath()); assertThat(newFile.delete(), is(true)); assertThat(configManager.checkDirectoryExists(newFile.toPath()), is(false)); }