String node2Rack2 = "n2r2";
String node1Rack3 = "n1r3";
ApplicationAttemptId appId = ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 0), 0);
ContainerId mockCId1 = ContainerId.newInstance(appId, 0);
HeldContainer hc1 = mock(HeldContainer.class, RETURNS_DEEP_STUBS);
when(hc1.getNode()).thenReturn(node1Rack1);
when(hc1.getRack()).thenReturn(rack1);
when(hc1.getContainer().getId()).thenReturn(mockCId1);
ContainerId mockCId2 = ContainerId.newInstance(appId, 1);
HeldContainer hc2 = mock(HeldContainer.class, RETURNS_DEEP_STUBS);
when(hc2.getNode()).thenReturn(node2Rack1);
when(hc2.getRack()).thenReturn(rack1);
when(hc2.getContainer().getId()).thenReturn(mockCId2);
ContainerId mockCId3 = ContainerId.newInstance(appId, 2);
HeldContainer hc3 = mock(HeldContainer.class, RETURNS_DEEP_STUBS);
when(hc3.getNode()).thenReturn(node1Rack1);
when(hc3.getRack()).thenReturn(rack1);
when(hc3.getContainer().getId()).thenReturn(mockCId3);
ContainerId mockCId4 = ContainerId.newInstance(appId, 3);
HeldContainer hc4 = mock(HeldContainer.class, RETURNS_DEEP_STUBS);
when(hc4.getNode()).thenReturn(node2Rack1);
when(hc4.getRack()).thenReturn(rack1);
when(hc4.getContainer().getId()).thenReturn(mockCId4);
ContainerId mockCId5 = ContainerId.newInstance(appId, 4);
HeldContainer hc5 = mock(HeldContainer.class, RETURNS_DEEP_STUBS);
when(hc5.getNode()).thenReturn(node1Rack2);
when(hc5.getRack()).thenReturn(rack2);
when(hc5.getContainer().getId()).thenReturn(mockCId5);
ContainerId mockCId6 = ContainerId.newInstance(appId, 5);
HeldContainer hc6 = mock(HeldContainer.class, RETURNS_DEEP_STUBS);
when(hc6.getNode()).thenReturn(node2Rack2);
when(hc6.getRack()).thenReturn(rack2);
when(hc6.getContainer().getId()).thenReturn(mockCId6);
ContainerId mockCId7 = ContainerId.newInstance(appId, 6);
HeldContainer hc7 = mock(HeldContainer.class, RETURNS_DEEP_STUBS);
when(hc7.getNode()).thenReturn(node1Rack3);
when(hc7.getRack()).thenReturn(rack3);
when(hc7.getContainer().getId()).thenReturn(mockCId7);
scheduler.heldContainers.put(mockCId1, hc1);
scheduler.heldContainers.put(mockCId2, hc2);
scheduler.heldContainers.put(mockCId3, hc3);
scheduler.heldContainers.put(mockCId4, hc4);