@UseDataProvider("annotationTypesWhenNeedToThrowWebApplicationExceptionWithStatusBadRequest") @Test public <A extends Annotation> void throwsWebApplicationExceptionWithStatusBadRequestWhenFailResolveParameterAnnotatedWith(Class<A> annotationType) throws Exception { when(resourceMethod.getMethodParameters()).thenReturn(newArrayList(annotatedParameter)); when(parameterAnnotation.annotationType()).thenReturn((Class)annotationType); Exception thrownByParameterResolver = new Exception(); when(parameterResolver.resolve(annotatedParameter, applicationContext)).thenThrow(thrownByParameterResolver); thrown.expect(webApplicationExceptionWithStatusMatcher(BAD_REQUEST)); methodInvoker.invokeMethod(new EchoResource(), resourceMethod, applicationContext); }
@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);  }