@Test
public void testChecklistKeyComparator() {

    final Checklist.JsonKeys keys = Checklist.keys();
    final String[] inputValues1 = keys.orderedKeys().toArray(new String[0]);
    Arrays.sort(inputValues1, Checklist.checklistKeyComparator.reversed());
    Arrays.sort(inputValues1, Checklist.checklistKeyComparator);
    assertArrayEquals("sort reverse sort should be stable",
            keys.orderedKeys().toArray(new String[0]), inputValues1);
    final String[] inputValues2 = new String[]{"foo", keys.name()};
    final String[] expectValues2 = new String[]{keys.name(), "foo"};
    Arrays.sort(inputValues2, Checklist.checklistKeyComparator);
    assertArrayEquals("sort unknown keys after known keys",
            expectValues2, inputValues2);
    final String[] inputValues2b = new String[]{keys.name(), "foo"};
    final String[] expectValues2b = new String[]{keys.name(), "foo"};
    Arrays.sort(inputValues2b, Checklist.checklistKeyComparator);
    assertArrayEquals("sort unknown keys after known keys",
            expectValues2b, inputValues2b);
    final String[] inputValues3 = new String[]{"b", "a"};
    final String[] expectValues3 = new String[]{"a", "b"};
    Arrays.sort(inputValues3, Checklist.checklistKeyComparator);
    assertArrayEquals("sort unknown keys using String.compareTo",
            expectValues3, inputValues3);
}