### Question:
FileServiceImpl implements FileService, ServletContextAware { @Override public List<String[]> listBundleDirectories(int maxResults) { List<String[]> rows = new ArrayList<String[]>(); HashMap<String, String> map = new HashMap<String, String>(); ListObjectsRequest request = new ListObjectsRequest(_bucketName, null, null, "/", maxResults); ObjectListing listing = null; do { if (listing == null) { listing = _s3.listObjects(request); if (listing.getCommonPrefixes() != null) { List<String> commonPrefixes = listing.getCommonPrefixes(); for (String key : commonPrefixes) { Date lastModified = getLastModifiedTimeForKey(key); String lastModifiedStr = "n/a"; if (lastModified != null) { lastModifiedStr = "" + lastModified.toString(); } String[] columns = { parseKey(key), getStatus(key), lastModifiedStr }; rows.add(columns); } return rows; } _log.error("prefixes=" + listing.getCommonPrefixes()); } else { listing = _s3.listNextBatchOfObjects(listing); } for (S3ObjectSummary summary : listing.getObjectSummaries()) { String key = parseKey(summary.getKey()); if (!map.containsKey(key)) { String[] columns = { key, " ", "" + summary.getLastModified().getTime()}; rows.add(columns); map.put(key, key); } } } while (listing.isTruncated()); return rows; }  @Override void setS3User(String user); @Override void setS3Password(String password); @Override void setBucketName(String bucketName); @Override String getBucketName(); @Override void setGtfsPath(String gtfsPath); @Override String getGtfsPath(); @Override void setStifPath(String stifPath); @Override String getStifPath(); @Override void setTransformationPath(String transformationPath); @Override String getTransformationPath(); @Override String getConfigPath(); @Override void setConfigPath(String configPath); @Override void setBuildPath(String buildPath); @Override String getBuildPath(); @PostConstruct @Override void setup(); @Override void setServletContext(ServletContext servletContext); @Override /** * check to see if the given bundle directory exists in the configured bucket. * Do not include leading slashes in the filename(key). */ boolean bundleDirectoryExists(String filename); @Override /** * delete an object from s3 */ void deleteObject(String filename); @Override boolean createBundleDirectory(String filename); @Override /** * Return tabular data (filename, flag, modified date) about bundle directories. */ List<String[]> listBundleDirectories(int maxResults); @Override /** * Copies an s3 object from one location to another */ void copyS3Object(String fromObjectKey, String toObjectKey); @Override /** * Return tabular data (filename, flag, modified date) about bundle directories. */ List<String> listBundleBuilds(String directoryName, int maxResults); @Override /** * Return files' names at a specified location. */ List<String> listFiles(String directoryName, int maxResults); @Override /** * Return fileName of objects in an S3 file. */ List<String> listObjects(String directoryName, int maxResults); @Override /** * Retrieve the specified key from S3 and store in the given directory. */ String get(String key, String tmpDir); InputStream get(String key); @Override /** * push the contents of the directory to S3 at the given key location. */ String put(String key, String file); String put(String prefix, String key, String file); @Override /** * list the files in the given directory. */ List<String> list(String directory, int maxResults); @Override String createOutputFilesZip(String s3Path); @Override void validateFileName(String fileName); List<Map<String,String>> listObjectsTabular(String directory, int maxResults);  }### Answer:
@Test public void testListBundleDirectories() { List<String[]> rows = fileService.listBundleDirectories(1000000000); assertNotNull(rows); assertTrue(rows.size() > 5); String[] row0 = rows.get(0); assertEquals("2012April", row0[0]); }