### Question:
S3PinotFS extends PinotFS { @Override public boolean exists(URI fileUri) throws IOException { try { if (isDirectory(fileUri)) { return true; } if (isPathTerminatedByDelimiter(fileUri)) { return false; } return existsFile(fileUri); } catch (NoSuchKeyException e) { 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 testExists() throws Exception { String[] originalFiles = new String[]{"a-ex.txt", "b-ex.txt", "c-ex.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 bucketExists = _s3PinotFS.exists(URI.create(String.format(DIR_FORMAT, SCHEME, BUCKET))); boolean dirExists = _s3PinotFS.exists(URI.create(String.format(FILE_FORMAT, SCHEME, BUCKET, folder))); boolean childDirExists = _s3PinotFS.exists(URI.create(String.format(FILE_FORMAT, SCHEME, BUCKET, folder + DELIMITER + childFolder))); boolean fileExists = _s3PinotFS.exists(URI.create( String.format(FILE_FORMAT, SCHEME, BUCKET, folder + DELIMITER + childFolder + DELIMITER + "a-ex.txt"))); boolean fileNotExists = _s3PinotFS.exists(URI.create( String.format(FILE_FORMAT, SCHEME, BUCKET, folder + DELIMITER + childFolder + DELIMITER + "d-ex.txt"))); Assert.assertTrue(bucketExists); Assert.assertTrue(dirExists); Assert.assertTrue(childDirExists); Assert.assertTrue(fileExists); Assert.assertFalse(fileNotExists); }