}
@Test
public void shouldRemoveMockitoInternalsFromStackTraceWhenRealMethodThrows() throws Throwable {
//given
CleanTraceRealMethod realMethod = new CleanTraceRealMethod(new RealMethod() {
public Object invoke(Object target, Object[] arguments) throws Throwable {
return new Foo().throwSomething();
}});
//when
try {
realMethod.invoke(null, null);
fail();
//then
} catch (Exception e) {
assertThat(e, hasMethodInStackTraceAt(0, "throwSomething"));
assertThat(e, hasMethodInStackTraceAt(1, "invoke"));