@Test
public void shouldNotAllowGettingExistingDirectories()
        throws IOException
{

    Repository repository = configurationManagementService.getConfiguration()
                                                          .getRepository(STORAGE0,
                                                                         REPOSITORY_RELEASES);
    RootRepositoryPath repositoryPath = repositoryPathResolver.resolve(repository);
    String artifactParentPathStr = "org/carlspring/logging/logback-configuration-core";
    Path artifactParentPath = repositoryPath.resolve(artifactParentPathStr);
    Files.createDirectories(artifactParentPath);
    String url = getContextBaseUrl() + "/storages/{storageId}/{repositoryId}/{artifactPath}";
    mockMvc.when()
           .get(url, repository.getStorage().getId(), repository.getId(), artifactParentPathStr)
           .peek()
           .then()
           .statusCode(HttpStatus.BAD_REQUEST.value())
           .statusLine(equalTo("400 The specified path is a directory!"));
    Files.delete(artifactParentPath);
    Files.delete(artifactParentPath.getParent());
}