ThemeBuilderUtils { public static String[] addToArray(String[] array, String stringToAdd) { String[] arrayToAdd = null; if (stringToAdd != null) { arrayToAdd = new String[1]; arrayToAdd[0] = stringToAdd; } return addToArray(array, arrayToAdd); }  static Properties retrieveThemeProperties(String themeDirectory); static void storeThemeProperties(String themeDirectory, Properties themeProperties); static List<String> getPropertyValueAsList(String key, Properties properties); static String[] getPropertyValueAsArray(String key, Properties properties); static void copyProperty(String propertyKey, Properties sourceProperties, Properties targetProperties); static void validateFileExistence(List<File> filesToValidate, String exceptionMessage); static boolean directoryContainsFile(File directory, String fileName); static List<File> getDirectoryFiles(File baseDirectory, String[] includes, String[] excludes); static List<String> getDirectoryFileNames(File baseDirectory, String[] includes, String[] excludes); static List<File> getSubDirectories(File baseDirectory, List<String> subDirectoryNames); static List<String> getDirectoryContents(File baseDirectory, String[] includes, String[] excludes); static void copyDirectory(String sourceDirectoryPath, String targetDirectoryPath); static void copyMissingContent(File sourceDirectory, File targetDirectory, List<String> sourceExcludes); static boolean inIncludeList(String name, String[] includes); static boolean inExcludeList(String name, String[] excludes); static void addExtensionToPatterns(String[] patterns, String extension); static List<String> getRelativePaths(File parentDirectory, List<File> files); static String getRelativePath(File parentDirectory, File file); static String calculatePathToFile(File fromFile, File toFile); static List<File> orderFiles(List<File> pluginFiles, List<File> subDirFiles, List<String> loadFirstPatterns,
            List<String> loadLastPatterns, List<String> pluginLoadOrder, List<String> subDirLoadOrder); static List<File> matchFiles(List<File> filesToMatch, String pattern); static boolean isMatch(File file, String pattern); static List<File> getContainedFiles(List<File> files, List<File> directories); static String[] addToArray(String[] array, String stringToAdd); static String[] addToArray(String[] array, String[] arrayToAdd); static String joinFileList(List<File> list);  }
@Test public void testAddStringToArray() { String[] array1 = new String[] {"a1", "a2"}; String stringToAdd = "b1"; String[] combinedArray = ThemeBuilderUtils.addToArray(array1, stringToAdd); Assert.assertEquals("Combined array length is not correct", 3, combinedArray.length); Assert.assertEquals("a1", combinedArray[0]); Assert.assertEquals("a2", combinedArray[1]); Assert.assertEquals("b1", combinedArray[2]); }
@Test public void testAddArrayToArray() { String[] array1 = new String[] {"a1", "a2"}; String[] array2 = new String[] {"b1", "b2", "b3"}; String[] combinedArray = ThemeBuilderUtils.addToArray(array1, array2); Assert.assertEquals("Combined array length is not correct", 5, combinedArray.length); Assert.assertEquals("a1", combinedArray[0]); Assert.assertEquals("a2", combinedArray[1]); Assert.assertEquals("b1", combinedArray[2]); Assert.assertEquals("b2", combinedArray[3]); Assert.assertEquals("b3", combinedArray[4]); array2 = null; combinedArray = ThemeBuilderUtils.addToArray(array1, array2); Assert.assertEquals("Combined array length is not correct", 2, combinedArray.length); Assert.assertEquals("a1", combinedArray[0]); Assert.assertEquals("a2", combinedArray[1]); array1 = null; array2 = new String[] {"b1", "b2", "b3"}; combinedArray = ThemeBuilderUtils.addToArray(array1, array2); Assert.assertEquals("Combined array length is not correct", 3, combinedArray.length); Assert.assertEquals("b1", combinedArray[0]); Assert.assertEquals("b2", combinedArray[1]); Assert.assertEquals("b3", combinedArray[2]); }