assertTrue("stack trace startsWith == java.lang.Exception: nested exception 3", stack1.startsWith("java.lang.Exception: nested exception 3")); int start1 = (stack1.length() - lineSepLen) - partialStackTraceLen; int end1 = stack1.length() - lineSepLen; assertEquals("stack trace substring(" + start1 + "," + end1 + ") == " + PARTIAL_STACK_TRACE, PARTIAL_STACK_TRACE, stack1.substring(start1, end1));
assertTrue("stack trace startsWith", stack1.startsWith(PARTIAL_STACK_TRACE));
    public void testNestableDelegetePrintStackTrace()    {        int lineSepLen = lineSeparator.length();        int partialStackTraceLen = PARTIAL_STACK_TRACE.length();        Nestable ne3 = new ThrowableNestedNestable(new Exception("nested exception 3"));        NestableDelegate nd3 = new NestableDelegate(ne3);        ByteArrayOutputStream baos1 = new ByteArrayOutputStream();        PrintStream ps1 = new PrintStream(baos1);        nd3.printStackTrace(ps1);        String stack1 = baos1.toString();        assertTrue("stack trace startsWith == java.lang.Exception: nested exception 3",            stack1.startsWith("java.lang.Exception: nested exception 3"));        int start1 = (stack1.length() - lineSepLen) - partialStackTraceLen;        int end1 = stack1.length() - lineSepLen;        assertEquals("stack trace substring(" + start1 + "," + end1 + ") == " +                     PARTIAL_STACK_TRACE,                     PARTIAL_STACK_TRACE,                     stack1.substring(start1, end1));        ByteArrayOutputStream baos2 = new ByteArrayOutputStream();        PrintStream ps2 = new PrintStream(baos2);        System.setErr(ps2);        nd3.printStackTrace();        String stack2 = baos2.toString();        assertTrue("stack trace startsWith == java.lang.Exception: nested exception 3",            stack2.startsWith("java.lang.Exception: nested exception 3"));        int start2 = (stack2.length() - lineSepLen) - partialStackTraceLen;        int end2 = stack2.length() - lineSepLen;        assertTrue("stack trace substring(" + start2 + "," + end2 + ") == " + PARTIAL_STACK_TRACE,            stack2.substring(start2, end2).equals(PARTIAL_STACK_TRACE));    }