CglibThrowableRenderer implements ThrowableRenderer { @Override public String[] doRender(Throwable th) { List<String> lines = new ArrayList<String>(); lines.add(th.toString()); addStackTraceToList(th, lines, 0); do { th = th.getCause(); if (th != null) { lines.add("Caused by: " + th.toString()); addStackTraceToList(th, lines, MAX_NUMBER_OF_STACK_TRACES_ON_LOG_FOR_CAUSE); } } while (th != null); return lines.toArray(new String[lines.size()]); }  @Override String[] doRender(Throwable th);  }
@Test public void testDoRendere() { SampleClass sampleClass = (SampleClass)Enhancer.create(SampleClass.class, new MyInvocationHandler()); try { sampleClass.theFirstMethodThatCapturesAnException(); } catch (Exception e) { String[] exceptions = cglibThrowableRenderer.doRender(e); assertThatTheTraceListDoesNotContainsCgLibLogs(exceptions); } }