@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); }
@Override public final Object invokeMethod(Object resource, GenericResourceMethod methodResource, ApplicationContext context) { Object[] params = makeMethodParameters(methodResource, context); beforeInvokeMethod(resource, methodResource, params, context); return invokeMethod(resource, methodResource, params, context); }
DefaultMethodInvoker implements MethodInvoker { @Override public final Object invokeMethod(Object resource, GenericResourceMethod methodResource, ApplicationContext context) { Object[] params = makeMethodParameters(methodResource, context); beforeInvokeMethod(resource, methodResource, params, context); return invokeMethod(resource, methodResource, params, context); } }
DefaultMethodInvoker implements MethodInvoker { @Override public final Object invokeMethod(Object resource, GenericResourceMethod methodResource, ApplicationContext context) { Object[] params = makeMethodParameters(methodResource, context); beforeInvokeMethod(resource, methodResource, params, context); return invokeMethod(resource, methodResource, params, context); } DefaultMethodInvoker(ParameterResolverFactory parameterResolverFactory); }
DefaultMethodInvoker implements MethodInvoker { @Override public final Object invokeMethod(Object resource, GenericResourceMethod methodResource, ApplicationContext context) { Object[] params = makeMethodParameters(methodResource, context); beforeInvokeMethod(resource, methodResource, params, context); return invokeMethod(resource, methodResource, params, context); } DefaultMethodInvoker(ParameterResolverFactory parameterResolverFactory); @Override final Object invokeMethod(Object resource, GenericResourceMethod methodResource, ApplicationContext context); Object invokeMethod(Object resource, GenericResourceMethod methodResource, Object[] params, ApplicationContext context); }
DefaultMethodInvoker implements MethodInvoker { @Override public final Object invokeMethod(Object resource, GenericResourceMethod methodResource, ApplicationContext context) { Object[] params = makeMethodParameters(methodResource, context); beforeInvokeMethod(resource, methodResource, params, context); return invokeMethod(resource, methodResource, params, context); } DefaultMethodInvoker(ParameterResolverFactory parameterResolverFactory); @Override final Object invokeMethod(Object resource, GenericResourceMethod methodResource, ApplicationContext context); Object invokeMethod(Object resource, GenericResourceMethod methodResource, Object[] params, ApplicationContext context);  }