@Test public void shouldInjectOnlyAttributesWithSameType() throws Exception { Object result = mock(Result.class); ResourceBundle emptyBundle = mock(ResourceBundle.class); ResourceMethod method = DefaultResourceMethod.instanceFor(OtherResource.class, OtherResource.class.getDeclaredMethod("logic", String.class)); when(request.getAttribute("result")).thenReturn(result); when(request.getParameterValues("result")).thenReturn(new String[] { "buggy" }); when(request.getParameterNames()).thenReturn(enumeration(asList("result"))); when(nameProvider.parameterNamesFor(method.getMethod())).thenReturn(new String[] { "result" }); List<Message> errors = new ArrayList<Message>(); Object[] out = provider.getParametersFor(method, errors, emptyBundle); assertThat(out[0], is(not(result))); }
public Object[] getParametersFor(ResourceMethod method, List<Message> errors, ResourceBundle bundle) { Parameters parameters = parseParameters(servletRequest); List<Target<Object>> targets = createTargets(method); List<Object> arguments = instantiateParameters(parameters, targets, errors); return arguments.toArray(); }
IogiParametersProvider implements ParametersProvider { public Object[] getParametersFor(ResourceMethod method, List<Message> errors, ResourceBundle bundle) { Parameters parameters = parseParameters(servletRequest); List<Target<Object>> targets = createTargets(method); List<Object> arguments = instantiateParameters(parameters, targets, errors); return arguments.toArray(); } }
IogiParametersProvider implements ParametersProvider { public Object[] getParametersFor(ResourceMethod method, List<Message> errors, ResourceBundle bundle) { Parameters parameters = parseParameters(servletRequest); List<Target<Object>> targets = createTargets(method); List<Object> arguments = instantiateParameters(parameters, targets, errors); return arguments.toArray(); } IogiParametersProvider(ParameterNameProvider provider, HttpServletRequest parameters, InstantiatorWithErrors instantiator); }
IogiParametersProvider implements ParametersProvider { public Object[] getParametersFor(ResourceMethod method, List<Message> errors, ResourceBundle bundle) { Parameters parameters = parseParameters(servletRequest); List<Target<Object>> targets = createTargets(method); List<Object> arguments = instantiateParameters(parameters, targets, errors); return arguments.toArray(); } IogiParametersProvider(ParameterNameProvider provider, HttpServletRequest parameters, InstantiatorWithErrors instantiator); Object[] getParametersFor(ResourceMethod method, List<Message> errors, ResourceBundle bundle); }
IogiParametersProvider implements ParametersProvider { public Object[] getParametersFor(ResourceMethod method, List<Message> errors, ResourceBundle bundle) { Parameters parameters = parseParameters(servletRequest); List<Target<Object>> targets = createTargets(method); List<Object> arguments = instantiateParameters(parameters, targets, errors); return arguments.toArray(); } IogiParametersProvider(ParameterNameProvider provider, HttpServletRequest parameters, InstantiatorWithErrors instantiator); Object[] getParametersFor(ResourceMethod method, List<Message> errors, ResourceBundle bundle);  }