@Test
  public void testPriorityAndFIFO() throws Exception {
    final RegionNormalizerWorkQueue<Integer> queue = new RegionNormalizerWorkQueue<>();
    final List<Integer> content = new LinkedList<>();
    queue.putAll(Arrays.asList(4, 3, 2, 1));
    assertEquals(4, queue.size());
    queue.putFirst(0);
    assertEquals(5, queue.size());
    drainTo(queue, content);
    assertThat("putFirst items should jump the queue, preserving existing order", content,
      contains(0, 4, 3, 2, 1));

    queue.clear();
    content.clear();
    queue.putAll(Arrays.asList(4, 3, 2, 1));
    queue.putFirst(1);
    assertEquals(4, queue.size());
    drainTo(queue, content);
    assertThat("existing items re-added with putFirst should jump the queue", content,
      contains(1, 4, 3, 2));

    queue.clear();
    content.clear();
    queue.putAll(Arrays.asList(4, 3, 2, 1));
    queue.putAllFirst(Arrays.asList(2, 3));
    assertEquals(4, queue.size());
    drainTo(queue, content);
    assertThat(
      "existing items re-added with putAllFirst jump the queue AND honor changes in priority",
      content, contains(2, 3, 4, 1));
  }
Tests that {@link RegionNormalizerWorkQueue} implements the contract described in its docstring.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestRegionNormalizerWorkQueue.java