@Test
public void testGetOnlyNameServiceIdOrNull() {

  HdfsConfiguration conf = new HdfsConfiguration();
  conf.set(DFS_NAMESERVICES, "ns1,ns2");
  assertNull(DFSUtil.getOnlyNameServiceIdOrNull(conf));
  conf.set(DFS_NAMESERVICES, "");
  assertNull(DFSUtil.getOnlyNameServiceIdOrNull(conf));
  conf.set(DFS_NAMESERVICES, "ns1");
  assertEquals("ns1", DFSUtil.getOnlyNameServiceIdOrNull(conf));
}