NamenodeJspHelper { static String getNameNodeLabel(NameNode nn) { return nn.getRpcServer() != null ? nn.getNameNodeAddressHostPortString() : "initializing"; }    }
@Test public void testGetNameNodeLabel() { String nameNodeLabel = NamenodeJspHelper.getNameNodeLabel( cluster.getNameNode()); Assert.assertNotNull(nameNodeLabel); Assert.assertFalse(nameNodeLabel.isEmpty()); }
@Test public void testGetNameNodeLabelNullRpcServer() { NameNode nn = mock(NameNode.class); when(nn.getRpcServer()).thenReturn(null); String nameNodeLabel = NamenodeJspHelper.getNameNodeLabel( cluster.getNameNode()); Assert.assertNotNull(nameNodeLabel); Assert.assertFalse(nameNodeLabel.isEmpty()); }