@Test
public void compare() {

    Contingency contingency1 = Mockito.mock(Contingency.class);
    Mockito.when(contingency1.getId()).thenReturn("contingency1");
    PostContingencyResult result1 = new PostContingencyResult(contingency1, true, Collections.emptyList());
    Contingency contingency2 = Mockito.mock(Contingency.class);
    Mockito.when(contingency2.getId()).thenReturn("contingency2");
    PostContingencyResult result2 = new PostContingencyResult(contingency2, true, Collections.emptyList());
    Contingency contingency3 = Mockito.mock(Contingency.class);
    Mockito.when(contingency3.getId()).thenReturn("contingency3");
    PostContingencyResult result3 = new PostContingencyResult(contingency3, true, Collections.emptyList());
    List<PostContingencyResult> results = Arrays.asList(result3, result1, result2);
    Collections.sort(results, new PostContingencyResultComparator());
    assertEquals(result1, results.get(0));
    assertEquals(result2, results.get(1));
    assertEquals(result3, results.get(2));
}