@Test public final void testBuildFileListJsonShouldEmptyJsonWhenDirectoryIsNotADirectory() { String expected = "{\"files\":[]}"; given(file.list()).willReturn(null); String actual = underTest.buildFileListJson(file); assertEquals(actual, expected); }
public String buildFileListJson(final File directory) { String result = "{\"files\":[]}"; Collection<File> messageFiles = fileUtilsWrapper.listFiles(directory); if (messageFiles != null) { List<String> fileNames = getFileNames(messageFiles); Collections.sort(fileNames); result = getJson(fileNames); } else { logger.debug("The directory '" + directory + "' has not been created yet, or an I/O error occurred."); } return result; }
FileListJsonBuilder { public String buildFileListJson(final File directory) { String result = "{\"files\":[]}"; Collection<File> messageFiles = fileUtilsWrapper.listFiles(directory); if (messageFiles != null) { List<String> fileNames = getFileNames(messageFiles); Collections.sort(fileNames); result = getJson(fileNames); } else { logger.debug("The directory '" + directory + "' has not been created yet, or an I/O error occurred."); } return result; } }
FileListJsonBuilder { public String buildFileListJson(final File directory) { String result = "{\"files\":[]}"; Collection<File> messageFiles = fileUtilsWrapper.listFiles(directory); if (messageFiles != null) { List<String> fileNames = getFileNames(messageFiles); Collections.sort(fileNames); result = getJson(fileNames); } else { logger.debug("The directory '" + directory + "' has not been created yet, or an I/O error occurred."); } return result; }  }
FileListJsonBuilder { public String buildFileListJson(final File directory) { String result = "{\"files\":[]}"; Collection<File> messageFiles = fileUtilsWrapper.listFiles(directory); if (messageFiles != null) { List<String> fileNames = getFileNames(messageFiles); Collections.sort(fileNames); result = getJson(fileNames); } else { logger.debug("The directory '" + directory + "' has not been created yet, or an I/O error occurred."); } return result; }  String buildLogFileListJson(final File directory); String buildMessageFileListJson(final File directory, final int maxValue); String buildFileListJson(final File directory); }
FileListJsonBuilder { public String buildFileListJson(final File directory) { String result = "{\"files\":[]}"; Collection<File> messageFiles = fileUtilsWrapper.listFiles(directory); if (messageFiles != null) { List<String> fileNames = getFileNames(messageFiles); Collections.sort(fileNames); result = getJson(fileNames); } else { logger.debug("The directory '" + directory + "' has not been created yet, or an I/O error occurred."); } return result; }  String buildLogFileListJson(final File directory); String buildMessageFileListJson(final File directory, final int maxValue); String buildFileListJson(final File directory);  }