### Question:
SegmentDirectoryPaths { @Nullable public static File findMetadataFile(File indexDir) { return findFormatFile(indexDir, V1Constants.MetadataKeys.METADATA_FILE_NAME); } private  SegmentDirectoryPaths(); static File segmentDirectoryFor(File indexDir, SegmentVersion segmentVersion); static File findSegmentDirectory(File indexDir); static boolean isV3Directory(File path); @Nullable static File findMetadataFile(File indexDir); @Nullable static File findCreationMetaFile(File indexDir); @Nullable static File findTextIndexIndexFile(File indexDir, String column); @Nullable @VisibleForTesting static File findTextIndexDocIdMappingFile(File indexDir, String column); static final String V3_SUBDIRECTORY_NAME; }### Answer:
@Test public void testFindMetadataFile() throws Exception { File indexDir = new File(SegmentDirectoryPaths.class.toString()); FileUtils.deleteQuietly(indexDir); try { Assert.assertTrue(indexDir.mkdirs()); File v3Dir = new File(indexDir, SegmentDirectoryPaths.V3_SUBDIRECTORY_NAME); Assert.assertTrue(v3Dir.mkdir()); String fileName = V1Constants.MetadataKeys.METADATA_FILE_NAME; File v1File = new File(indexDir, fileName); FileUtils.touch(v1File); File v3File = new File(v3Dir, fileName); FileUtils.touch(v3File); Assert.assertEquals(SegmentDirectoryPaths.findMetadataFile(indexDir), v3File); FileUtils.forceDelete(v3File); Assert.assertEquals(SegmentDirectoryPaths.findMetadataFile(indexDir), v1File); FileUtils.forceDelete(v1File); Assert.assertNull(SegmentDirectoryPaths.findMetadataFile(indexDir)); } finally { FileUtils.deleteQuietly(indexDir); } }