@Test
public void testResolveArgument()
    throws MissingPathVariableException
{

    Map<String, String> uriTemplateVars = new HashMap<>();
    uriTemplateVars.put("storageId", "storage-pypi");
    uriTemplateVars.put("repositoryId", "pypi-releases");
    nativeWebRequest.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars,
                                  RequestAttributes.SCOPE_REQUEST);
    mockStoragesAndRepositories(RepositoryStatusEnum.OUT_OF_SERVICE);
    MethodParameter uploadArtifactWithOutOfServiceRepositoryAllowedMethod = getMethodParameter("uploadArtifactWithOutOfServiceRepositoryAllowed",
                                                                                               Repository.class);
    Repository repository = (Repository) repositoryMethodArgumentResolver.resolveArgument(uploadArtifactWithOutOfServiceRepositoryAllowedMethod,
                                                                                          modelAndViewContainer,
                                                                                          nativeWebRequest,
                                                                                          webDataBinderFactory);
    assertNotNull(repository);
    mockStoragesAndRepositories(RepositoryStatusEnum.IN_SERVICE);
    repository = (Repository) repositoryMethodArgumentResolver.resolveArgument(uploadArtifactWithOutOfServiceRepositoryAllowedMethod,
                                                                               modelAndViewContainer,
                                                                               nativeWebRequest,
                                                                               webDataBinderFactory);
    assertNotNull(repository);
    mockStoragesAndRepositories(RepositoryStatusEnum.IN_SERVICE);
    MethodParameter uploadArtifactWithOutOfServiceRepositoryNotAllowedMethod = getMethodParameter("uploadArtifactWithOutOfServiceRepositoryNotAllowed",
                                                                                                  Repository.class);
    repository = (Repository) repositoryMethodArgumentResolver.resolveArgument(uploadArtifactWithOutOfServiceRepositoryNotAllowedMethod,
                                                                               modelAndViewContainer,
                                                                               nativeWebRequest,
                                                                               webDataBinderFactory);
    assertNotNull(repository);
}