### Question:
S3PinotFS extends PinotFS { @Override public boolean isDirectory(URI uri) throws IOException { try { String prefix = normalizeToDirectoryPrefix(uri); if (prefix.equals(DELIMITER)) { return true; } ListObjectsV2Request listObjectsV2Request = ListObjectsV2Request .builder().bucket(uri.getHost()) .prefix(prefix).maxKeys(2).build(); ListObjectsV2Response listObjectsV2Response = _s3Client.listObjectsV2(listObjectsV2Request); return listObjectsV2Response.hasContents(); } catch (NoSuchKeyException e) { LOGGER.error("Could not get directory entry for {}", uri); return false; } }  @Override void init(PinotConfiguration config); void init(S3Client s3Client); @Override boolean mkdir(URI uri); @Override boolean delete(URI segmentUri, boolean forceDelete); @Override boolean doMove(URI srcUri, URI dstUri); @Override boolean copy(URI srcUri, URI dstUri); @Override boolean exists(URI fileUri); @Override long length(URI fileUri); @Override String[] listFiles(URI fileUri, boolean recursive); @Override void copyToLocalFile(URI srcUri, File dstFile); @Override void copyFromLocalFile(File srcFile, URI dstUri); @Override boolean isDirectory(URI uri); @Override long lastModified(URI uri); @Override boolean touch(URI uri); @Override InputStream open(URI uri); @Override void close(); static final String ACCESS_KEY; static final String SECRET_KEY; static final String REGION; static final String ENDPOINT; static final String S3_SCHEME; }### Answer:
@Test public void testIsDirectory() throws Exception { String[] originalFiles = new String[]{"a-dir.txt", "b-dir.txt", "c-dir.txt"}; String folder = "my-files-dir"; String childFolder = "my-files-dir-child"; for (String fileName : originalFiles) { String folderName = folder + DELIMITER + childFolder; createEmptyFile(folderName, fileName); } boolean isBucketDir = _s3PinotFS.isDirectory(URI.create(String.format(DIR_FORMAT, SCHEME, BUCKET))); boolean isDir = _s3PinotFS.isDirectory(URI.create(String.format(FILE_FORMAT, SCHEME, BUCKET, folder))); boolean isDirChild = _s3PinotFS .isDirectory(URI.create(String.format(FILE_FORMAT, SCHEME, BUCKET, folder + DELIMITER + childFolder))); boolean notIsDir = _s3PinotFS.isDirectory(URI.create( String.format(FILE_FORMAT, SCHEME, BUCKET, folder + DELIMITER + childFolder + DELIMITER + "a-delete.txt"))); Assert.assertTrue(isBucketDir); Assert.assertTrue(isDir); Assert.assertTrue(isDirChild); Assert.assertFalse(notIsDir); }