Source:
<code>void testUndeleteArtifactFromTrashForRepository(String acceptHeader, @MavenRepository(repositoryId = REPOSITORY_WITH_TRASH_1, setup = MavenIndexedRepositorySetup.class) @RepositoryAttributes(trashEnabled = true) Repository repository, @MavenTestArtifact(repositoryId = REPOSITORY_WITH_TRASH_1, id = "org.carlspring.strongbox.undelete:test-artifact-undelete", versions = { "1.0", "1.1" }) List<Path> artifactsPaths) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); final RootRepositoryPath repositoryPath = repositoryPathResolver.resolve(repository); final Path artifact10Path = artifactsPaths.get(0); <START> final String artifact10PathStr = repositoryPath.relativize(artifact10Path).toString(); <END> final Path artifact11Path = artifactsPaths.get(1); final String artifact11PathStr = repositoryPath.relativize(artifact11Path).toString(); client.delete(storageId, repositoryId, artifact10PathStr); client.delete(storageId, repositoryId, artifact11PathStr); String url = getContextBaseUrl() + "/{storageId}/{repositoryId}/{artifactPath}"; ValidatableMockMvcResponse response = given().accept(acceptHeader) .when() .post(url, storageId, repositoryId, artifact10PathStr) .peek() .then() .statusCode(HttpStatus.OK.value()); String message = String.format("The trash for '%s:%s' was restored successfully.", storageId, repositoryId); validateResponseBody(response, acceptHeader, message); final Path artifactFileInTrash = RepositoryFiles.trash((RepositoryPath) artifact10Path); assertFalse(Files.exists(artifactFileInTrash), "Failed to undelete trash for repository '" + repositoryId + "'!"); assertTrue(Files.exists(artifact10Path), "Failed to undelete trash for repository '" + repositoryId + "'!"); }</code><technical_language>@ptirador RepositoryFiles.relativizePath</technical_language>

Target:
void testUndeleteArtifactFromTrashForRepository(String acceptHeader, @MavenRepository(repositoryId = REPOSITORY_WITH_TRASH_1, setup = MavenIndexedRepositorySetup.class) @RepositoryAttributes(trashEnabled = true) Repository repository, @MavenTestArtifact(repositoryId = REPOSITORY_WITH_TRASH_1, id = "org.carlspring.strongbox.undelete:test-artifact-undelete", versions = { "1.0", "1.1" }) List<Path> artifactsPaths) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); final RepositoryPath artifact10Path = (RepositoryPath) artifactsPaths.get(0).normalize(); final String artifact10PathStr = RepositoryFiles.relativizePath(artifact10Path); final RepositoryPath artifact11Path = (RepositoryPath) artifactsPaths.get(1).normalize(); final String artifact11PathStr = RepositoryFiles.relativizePath(artifact11Path); client.delete(storageId, repositoryId, artifact10PathStr); client.delete(storageId, repositoryId, artifact11PathStr); String url = getContextBaseUrl() + "/{storageId}/{repositoryId}/{artifactPath}"; ValidatableMockMvcResponse response = given().accept(acceptHeader) .when() .post(url, storageId, repositoryId, artifact10PathStr) .peek() .then() .statusCode(HttpStatus.OK.value()); String message = String.format("The trash for '%s:%s' was restored successfully.", storageId, repositoryId); validateResponseBody(response, acceptHeader, message); final Path artifactFileInTrash = RepositoryFiles.trash(artifact10Path); assertFalse(Files.exists(artifactFileInTrash), "Failed to undelete trash for repository '" + repositoryId + "'!"); assertTrue(Files.exists(artifact10Path), "Failed to undelete trash for repository '" + repositoryId + "'!"); }