@Test
public void testUpdateNodeResource() throws Exception {

  String nodeIdStr = "0.0.0.0:0";
  int memSize = 2048;
  int cores = 2;
  String[] args = { "-updateNodeResource", nodeIdStr,
      Integer.toString(memSize), Integer.toString(cores) };
  assertEquals(0, rmAdminCLI.run(args));
  ArgumentCaptor<UpdateNodeResourceRequest> argument =
      ArgumentCaptor.forClass(UpdateNodeResourceRequest.class);
  verify(admin).updateNodeResource(argument.capture());
  UpdateNodeResourceRequest request = argument.getValue();
  Map<NodeId, ResourceOption> resourceMap = request.getNodeResourceMap();
  NodeId nodeId = NodeId.fromString(nodeIdStr);
  Resource expectedResource = Resources.createResource(memSize, cores);
  ResourceOption resource = resourceMap.get(nodeId);
  assertNotNull("resource for " + nodeIdStr + " shouldn't be null.",
      resource);
  assertEquals("resource value for " + nodeIdStr + " is not as expected.",
      ResourceOption.newInstance(expectedResource,
          ResourceOption.OVER_COMMIT_TIMEOUT_MILLIS_DEFAULT),
      resource);
}