@Test
  public void testPriorityQueueOrdering() {
    PriorityQueue<SamzaResourceRequest> pq = new PriorityQueue<>();
    Instant now = Instant.now();

    ImmutableList<SamzaResourceRequest> expectedOrder = ImmutableList.of(
        createRequestForActive(now.minusSeconds(120)),
        createRequestForActive(now),
        createRequestForActive(now.plusSeconds(120)),
        createRequestForActive(now.plusSeconds(240)),
        createRequestForStandby(now.minusSeconds(120)),
        createRequestForStandby(now),
        createRequestForStandby(now.plusSeconds(120)),
        createRequestForStandby(now.plusSeconds(240)));

    SamzaResourceRequest[] copyExpectedOrder = new SamzaResourceRequest[expectedOrder.size()];
    copyExpectedOrder = expectedOrder.toArray(copyExpectedOrder);
    List<SamzaResourceRequest> shuffled = Arrays.asList(copyExpectedOrder);

    Collections.shuffle(shuffled, new Random(Instant.now().toEpochMilli()));
    pq.addAll(shuffled);

    ArrayList priorityQueueOrder = new ArrayList();
    for (int i = 0; i < expectedOrder.size(); ++i) {
      priorityQueueOrder.add(pq.poll());
    }
    assertEquals(expectedOrder, priorityQueueOrder);
  }
Test request state after container is assigned to a host
* Assigned on requested host
* Assigned on any host
samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerRequestState.java