boolean visit(ResourceRequest rr) {
    Priority priority = rr.getPriority();
    Resource capability = rr.getCapability();

    Map<Resource, TrackerPerPriorityResource> subMap = map.get(priority);
    if (subMap == null) {
      subMap = new HashMap<>();
      map.put(priority, subMap);
    }

    TrackerPerPriorityResource tracker = subMap.get(capability);
    if (tracker == null) {
      tracker = new TrackerPerPriorityResource();
      subMap.put(capability, tracker);
    }

    return tracker.visit(rr.getResourceName());
  }
@Test
  public void testVisitRackRequestFirst() {
    VisitedResourceRequestTracker tracker =
        new VisitedResourceRequestTracker(nodeTracker);

    // Visit rack request first
    assertTrue(FIRST_CALL_FAILURE, tracker.visit(rackRequest));

    // All other requests should return false
    assertFalse(RACK_VISITED + ANY_FAILURE, tracker.visit(anyRequest));
    assertFalse(RACK_VISITED + NODE_FAILURE, tracker.visit(node1Request));
    assertFalse(RACK_VISITED + NODE_FAILURE, tracker.visit(node2Request));
  }