@Test
public void invokesMethodWithNullEntityParameterWhenMessageBodyReaderIsNotAvailableAndBothContentTypeAndContentLengthAreNotSet() throws Exception {

    when(applicationContext.getContainerRequest().getMediaType()).thenReturn(null);
    when(applicationContext.getProviders()
                           .getMessageBodyReader((Class)entityParameter.getParameterClass(),
                                                 entityParameter.getGenericType(),
                                                 entityParameter.getAnnotations(),
                                                 applicationContext.getContainerRequest().getMediaType()))
            .thenReturn(null);
    when(resourceMethod.getMethodParameters()).thenReturn(newArrayList(entityParameter));
    MultivaluedMap<String, String> headers = new MultivaluedHashMap<>();
    headers.putSingle(CONTENT_LENGTH, "0");
    when(applicationContext.getContainerRequest().getRequestHeaders()).thenReturn(headers);
    Object invocationResult = methodInvoker.invokeMethod(new EchoResource(), resourceMethod, applicationContext);
    assertEquals(null, invocationResult);
}