### Question:
DFSUtil { public static String getNamenodeNameServiceId(Configuration conf) { return getNameServiceId(conf, DFS_NAMENODE_RPC_ADDRESS_KEY); } private  DFSUtil(); static Random getRandom(); static SecureRandom getSecureRandom(); static boolean isValidName(String src); static String bytes2String(byte[] bytes); static byte[] string2Bytes(String str); static String byteArray2String(byte[][] pathComponents); static byte[][] bytes2byteArray(byte[] bytes, byte separator); static byte[][] bytes2byteArray(byte[] bytes,
                                         int len,
                                         byte separator); static BlockLocation[] locatedBlocks2Locations(LocatedBlocks blocks); static BlockLocation[] locatedBlocks2Locations(List<LocatedBlock> blocks); static Collection<String> getNameServiceIds(Configuration conf); static Collection<String> getNameNodeIds(Configuration conf, String nsId); static String addKeySuffixes(String key, String... suffixes); static Set<String> getAllNnPrincipals(Configuration conf); static Map<String, Map<String, InetSocketAddress>> getHaNnRpcAddresses(
      Configuration conf); static Map<String, Map<String, InetSocketAddress>> getBackupNodeAddresses(
      Configuration conf); static Map<String, Map<String, InetSocketAddress>> getSecondaryNameNodeAddresses(
      Configuration conf); static Map<String, Map<String, InetSocketAddress>> getNNServiceRpcAddresses(
      Configuration conf); static List<ConfiguredNNAddress> flattenAddressMap(
      Map<String, Map<String, InetSocketAddress>> map); static String addressMapToString(
      Map<String, Map<String, InetSocketAddress>> map); static String nnAddressesAsString(Configuration conf); static Collection<URI> getNsServiceRpcUris(Configuration conf); static Collection<URI> getNameServiceUris(Configuration conf,
      String... keys); static String getNameServiceIdFromAddress(final Configuration conf, 
      final InetSocketAddress address, String... keys); static String getInfoServer(InetSocketAddress namenodeAddr,
      Configuration conf, boolean httpsAddress); static String substituteForWildcardAddress(String configuredAddress,
      String defaultHost); static void setGenericConf(Configuration conf,
      String nameserviceId, String nnId, String... keys); static float getPercentUsed(long used, long capacity); static float getPercentRemaining(long remaining, long capacity); static String percent2String(double percentage); static int roundBytesToGB(long bytes); static ClientDatanodeProtocol createClientDatanodeProtocolProxy(
      DatanodeID datanodeid, Configuration conf, int socketTimeout,
      boolean connectToDnViaHostname, LocatedBlock locatedBlock); static ClientDatanodeProtocol createClientDatanodeProtocolProxy(
      InetSocketAddress addr, UserGroupInformation ticket, Configuration conf,
      SocketFactory factory); static String getNamenodeNameServiceId(Configuration conf); static String getBackupNameServiceId(Configuration conf); static String getSecondaryNameServiceId(Configuration conf); static URI createUri(String scheme, InetSocketAddress address); static void addPBProtocol(Configuration conf, Class<?> protocol,
      BlockingService service, RPC.Server server); static String getNamenodeServiceAddr(final Configuration conf,
      String nsId, String nnId); static String getOnlyNameServiceIdOrNull(Configuration conf); static boolean parseHelpArgument(String[] args,
      String helpDescription, PrintStream out, boolean printGenericCommandUsage); static float getInvalidateWorkPctPerIteration(Configuration conf); static int getReplWorkMultiplier(Configuration conf); static String getSpnegoKeytabKey(Configuration conf, String defaultKey); static final Log LOG; static final Comparator<DatanodeInfo> DECOM_COMPARATOR; static Options helpOptions; static Option helpOpt; }### Answer:
@Test public void getNameNodeNameServiceId() { Configuration conf = setupAddress(DFS_NAMENODE_RPC_ADDRESS_KEY); assertEquals("nn1", DFSUtil.getNamenodeNameServiceId(conf)); }