@Test
public void testGetClusterNodeLabelsWithLocalAccess() throws Exception {

  when(client.getClusterNodeLabels()).thenReturn(
      Arrays.asList(NodeLabel.newInstance("remote1"),
          NodeLabel.newInstance("remote2")));
  ClusterCLI cli = createAndGetClusterCLI();
  ClusterCLI.localNodeLabelsManager = mock(CommonNodeLabelsManager.class);
  when(ClusterCLI.localNodeLabelsManager.getClusterNodeLabels()).thenReturn(
      Arrays.asList(NodeLabel.newInstance("local1"),
          NodeLabel.newInstance("local2")));
  int rc =
      cli.run(new String[] { ClusterCLI.CMD,
          "-" + ClusterCLI.LIST_LABELS_CMD,
          "-" + ClusterCLI.DIRECTLY_ACCESS_NODE_LABEL_STORE });
  assertEquals(0, rc);
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  PrintWriter pw = new PrintWriter(baos);
  // it should return local* instead of remote*
  pw.print("Node Labels: <local1:exclusivity=true>,<local2:exclusivity=true>");
  pw.close();
  verify(sysOut).println(baos.toString("UTF-8"));
}