    @Test
    public void testHashCause() throws Throwable {

        StacktraceHash h = new StacktraceHash();
        Throwable t1 = null;
        Throwable t2 = null;
        try {
            new TestClass().foo(1);
        } catch (RuntimeException e) {
            t1 = e;
        }
        try {
            new TestClass().foo(1);
        } catch (RuntimeException e) {
            t2 = e;
        }
        assertEquals(
                h.hash(Stacktrace.getInstance(t1)),
                h.hash(Stacktrace.getInstance(t2))
        );

        // Set a cause to t1. Then hash are different.
        if (t1 != null) {
            t1.initCause(new RuntimeException("cause"));
        }
        assertNotEquals(
                h.hash(Stacktrace.getInstance(t1)),
                h.hash(Stacktrace.getInstance(t2))
        );
    }