@Test
public void wrapsExceptionThatOccursWhenReadEntityParameterWithInternalException() throws Exception {

    Exception thrownByMessageBodyReader = new IOException();
    when(messageBodyReader.readFrom((Class)entityParameter.getParameterClass(),
                                    entityParameter.getGenericType(),
                                    entityParameter.getAnnotations(),
                                    applicationContext.getContainerRequest().getMediaType(),
                                    applicationContext.getContainerRequest().getRequestHeaders(),
                                    applicationContext.getContainerRequest().getEntityStream())).thenThrow(thrownByMessageBodyReader);
    when(resourceMethod.getMethodParameters()).thenReturn(newArrayList(entityParameter));
    thrown.expect(InternalException.class);
    thrown.expectCause(exceptionSameInstanceMatcher(thrownByMessageBodyReader));
    methodInvoker.invokeMethod(new EchoResource(), resourceMethod, applicationContext);
}