RepositoryMethodArgumentResolver implements HandlerMethodArgumentResolver { @Override public boolean supportsParameter(final MethodParameter parameter) { if (!parameter.hasParameterAnnotation(RepositoryMapping.class)) { return false; } return parameter.getParameterType().equals(Repository.class); }  @Override boolean supportsParameter(final MethodParameter parameter); @Override Object resolveArgument(final MethodParameter parameter,
                                  final ModelAndViewContainer modelAndViewContainer,
                                  final NativeWebRequest nativeWebRequest,
                                  final WebDataBinderFactory webDataBinderFactory); static final String NOT_FOUND_STORAGE_MESSAGE; static final String NOT_FOUND_REPOSITORY_MESSAGE; static final String NOT_IN_SERVICE_REPOSITORY_MESSAGE; }
@Test public void testSupportsParameter() { boolean supportsParameterTrueCase1 = repositoryMethodArgumentResolver.supportsParameter(getMethodParameter("uploadArtifactWithRepositoryMapping", Repository.class)); assertTrue(supportsParameterTrueCase1); boolean supportsParameterTrueCase2 = repositoryMethodArgumentResolver.supportsParameter(getMethodParameter("uploadArtifactWithOutOfServiceRepositoryAllowed", Repository.class)); assertTrue(supportsParameterTrueCase2); boolean supportsParameterTrueCase3 = repositoryMethodArgumentResolver.supportsParameter(getMethodParameter("uploadArtifactWithOutOfServiceRepositoryNotAllowed", Repository.class)); assertTrue(supportsParameterTrueCase3); boolean supportsParameterFalseCase1 = repositoryMethodArgumentResolver.supportsParameter(getMethodParameter("uploadArtifactWithoutRepositoryMapping", Repository.class)); assertFalse(supportsParameterFalseCase1); boolean supportsParameterFalseCase2 = repositoryMethodArgumentResolver.supportsParameter(getMethodParameter("uploadArtifactWithRepositoryMappingAndInvalidRepository", RepositoryData.class)); assertFalse(supportsParameterFalseCase2); }