@ExtendWith({ RepositoryManagementTestExecutionListener.class,

              ArtifactManagementTestExecutionListener.class })
@Test
public void testUpdateMetadataOnDeleteSnapshotVersionDirectory(@MavenRepository(repositoryId = REPOSITORY_SNAPSHOTS,
                                                                                policy = RepositoryPolicyEnum.SNAPSHOT)
                                                               Repository repository,
                                                               @MavenTestArtifact(repositoryId = REPOSITORY_SNAPSHOTS,
                                                                                  id = "org.carlspring.strongbox.metadata:metadata-foo",
                                                                                  versions = { "3.1-20190812.124500-1",
                                                                                               "3.1-20190812.124600-2",
                                                                                               "3.1-20190812.124700-3",
                                                                                               "3.1-20190812.124800-4" })
                                                               List<Path> artifactsPaths)
        throws XmlPullParserException,
               IOException,
               ArtifactOperationException,
               ArtifactTransportException
{
    // Given
    final String storageId = repository.getStorage().getId();
    final String repositoryId = repository.getId();
    mavenMetadataServiceHelper.generateMavenMetadata(repository);
    RepositoryPath artifact1RepositoryPath = (RepositoryPath) artifactsPaths.get(0).normalize();
    String artifact1RepositoryPathStr = RepositoryFiles.relativizePath(artifact1RepositoryPath);
    String unixBasedRelativePath = FilenameUtils.separatorsToUnix(artifact1RepositoryPathStr);
    Artifact artifact1 = MavenArtifactUtils.convertPathToArtifact(unixBasedRelativePath);
    RepositoryPath artifact1ParentPath = artifact1RepositoryPath.getParent();
    String artifact1ParentPathStr = RepositoryFiles.relativizePath(artifact1ParentPath);
    // When
    client.delete(storageId, repositoryId, artifact1ParentPathStr);
    // Then
    assertThat(artifact1).isNotNull();
    String metadataPath = String.format("/storages/%s/%s/%s",
                                        storageId,
                                        repositoryId,
                                        getArtifactLevelMetadataPath(artifact1));
    Metadata metadata = defaultMavenArtifactDeployer.retrieveMetadata(metadataPath);
    assertThat(metadata.getVersioning().getVersions().contains("3.1-SNAPSHOT")).isFalse();
}