### Question:
ServerUtils { public static File getScmDbDir(ConfigurationSource conf) { File metadataDir = getDirectoryFromConfig(conf, ScmConfigKeys.OZONE_SCM_DB_DIRS, "SCM"); if (metadataDir != null) { return metadataDir; } LOG.warn("{} is not configured. We recommend adding this setting. " + "Falling back to {} instead.", ScmConfigKeys.OZONE_SCM_DB_DIRS, HddsConfigKeys.OZONE_METADATA_DIRS); return getOzoneMetaDirPath(conf); } private  ServerUtils(); static long sanitizeUserArgs(String key, long valueTocheck,
      String baseKey, long baseValue, long minFactor, long maxFactor); static InetSocketAddress updateRPCListenAddress(
      OzoneConfiguration conf, String rpcAddressKey,
      InetSocketAddress addr, RPC.Server rpcServer); static InetSocketAddress updateListenAddress(OzoneConfiguration conf,
      String addressKey, InetSocketAddress addr, InetSocketAddress listenAddr); static void releaseConnection(HttpRequestBase request); static File getScmDbDir(ConfigurationSource conf); static File getDirectoryFromConfig(ConfigurationSource conf,
                                            String key,
                                            String componentName); static File getOzoneMetaDirPath(ConfigurationSource conf); static void setOzoneMetaDirPath(OzoneConfiguration conf,
      String path); static File getDBPath(ConfigurationSource conf, String key); static String getRemoteUserName(); static String getDefaultRatisDirectory(ConfigurationSource conf);  }### Answer:
@Test public void testGetScmDbDir() { final File testDir = PathUtils.getTestDir(TestServerUtils.class); final File dbDir = new File(testDir, "scmDbDir"); final File metaDir = new File(testDir, "metaDir"); final OzoneConfiguration conf = new OzoneConfiguration(); conf.set(ScmConfigKeys.OZONE_SCM_DB_DIRS, dbDir.getPath()); conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDir.getPath()); try { assertFalse(metaDir.exists()); assertFalse(dbDir.exists()); assertEquals(dbDir, ServerUtils.getScmDbDir(conf)); assertTrue(dbDir.exists()); assertFalse(metaDir.exists()); } finally { FileUtils.deleteQuietly(dbDir); } }
@Test public void testGetScmDbDirWithFallback() { final File testDir = PathUtils.getTestDir(TestServerUtils.class); final File metaDir = new File(testDir, "metaDir"); final OzoneConfiguration conf = new OzoneConfiguration(); conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDir.getPath()); try { assertFalse(metaDir.exists()); assertEquals(metaDir, ServerUtils.getScmDbDir(conf)); assertTrue(metaDir.exists()); } finally { FileUtils.deleteQuietly(metaDir); } }
@Test public void testNoScmDbDirConfigured() { thrown.expect(IllegalArgumentException.class); ServerUtils.getScmDbDir(new OzoneConfiguration()); }