@Test
public void testOrderingUsingUsedAndPendingResources() {

  FairOrderingPolicy<MockSchedulableEntity> policy =
      new FairOrderingPolicy<>();
  policy.setSizeBasedWeight(true);
  MockSchedulableEntity r1 = new MockSchedulableEntity();
  MockSchedulableEntity r2 = new MockSchedulableEntity();
  r1.setUsed(Resources.createResource(4 * GB));
  r2.setUsed(Resources.createResource(4 * GB));
  r1.setPending(Resources.createResource(4 * GB));
  r2.setPending(Resources.createResource(4 * GB));
  AbstractComparatorOrderingPolicy
      .updateSchedulingResourceUsage(r1.getSchedulingResourceUsage());
  AbstractComparatorOrderingPolicy
      .updateSchedulingResourceUsage(r2.getSchedulingResourceUsage());
  // Same, equal
  assertEquals("Comparator Output", 0,
      policy.getComparator().compare(r1, r2));
  r1.setUsed(Resources.createResource(4 * GB));
  r2.setUsed(Resources.createResource(8 * GB));
  r1.setPending(Resources.createResource(4 * GB));
  r2.setPending(Resources.createResource(8 * GB));
  AbstractComparatorOrderingPolicy
      .updateSchedulingResourceUsage(r1.getSchedulingResourceUsage());
  AbstractComparatorOrderingPolicy
      .updateSchedulingResourceUsage(r2.getSchedulingResourceUsage());
  Assert.assertTrue(policy.getComparator().compare(r1, r2) < 0);
}