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