CommandDirectories { String buildGlobPatternForFileWithExtensions(String... extensions) { StringBuilder extensionsPattern = new StringBuilder("glob:**.{"); boolean first = true; for (String extension : extensions) { if (!first) { extensionsPattern.append(","); } else { first = false; } extensionsPattern.append(extension.toLowerCase()).append(",").append(extension.toUpperCase()); } extensionsPattern.append("}"); return extensionsPattern.toString(); } CommandDirectories(String sourceDirectoryPathString);  CommandDirectories(String sourceDirectoryPathString, String targetDirectoryPathString); Path resolveWithTargetDirectory(Path pathInSourceDirectory); Path resolveWithTargetDirectoryAndCreateParentDirectories(Path pathInSourceDirectory); Path relativizeWithSourceDirectory(Path path); Path relativizeWithTargetDirectory(Path path); Path relativizeWithUserDirectory(Path path); List<Path> listFilesWithExtensionInSourceDirectory(String... extensions); Path getSourceDirectoryPath(); Path getTargetDirectoryPath();  }
@Test public void testBuildGlobPatternForFileWithExtension() { CommandDirectories commandDirectories = new CommandDirectories(null); String expected = "glob:**.{jpg,JPG}"; String buildGlobPatternForFileWithExtension = commandDirectories.buildGlobPatternForFileWithExtensions("jpg"); assertEquals(expected, buildGlobPatternForFileWithExtension); }
@Test public void testBuildGlobPatternForFileWithExtensionMultiple() { CommandDirectories commandDirectories = new CommandDirectories(null); String expected = "glob:**.{jpg,JPG,png,PNG}"; String buildGlobPatternForFileWithExtension = commandDirectories.buildGlobPatternForFileWithExtensions("jpg", "png"); assertEquals(expected, buildGlobPatternForFileWithExtension); }