@Test
public void testApplyFindsRootCause() {

    /**
     * Lots of frameworks wrap exceptions with runtime exceptions. The root
     * cause is always more important.
     */
    SeverityComparator a = new SeverityComparator();
    final Throwable root = new Exception();
    Throwable next = root;
    for (int i = 0; i < 7; i++) {
        next = new RuntimeException(next);
    }
    Throwable reduced = a.apply(next);
    assertEquals(root, reduced);
}