@Test public void doesNotSupportNonPageable() { MethodParameter parameter = TestUtils.getParameterOfMethod(getControllerClass(), "unsupportedMethod", String.class); assertThat(getResolver().supportsParameter(parameter), is(false)); }
@Test public void rejectsNoQualifiers() throws Exception { MethodParameter parameter = TestUtils.getParameterOfMethod( getControllerClass(), "noQualifiers", Pageable.class, Pageable.class); HandlerMethodArgumentResolver resolver = getResolver(); assertThat(resolver.supportsParameter(parameter), is(true)); exception.expect(IllegalStateException.class); exception.expectMessage("Ambiguous"); resolver.resolveArgument(parameter, null, TestUtils.getWebRequest(), null); }
private static MethodParameter getParameterOfMethod(Class<?> controller, String name) { return TestUtils.getParameterOfMethod(controller, name, Pageable.class); }