Source:
<code>public void testRemoveTimestampedSnapshotsWithPreviousDate(@MavenRepository(repositoryId = TRTS_SNAPSHOTS, policy = RepositoryPolicyEnum.SNAPSHOT) Repository repository, @MavenTestArtifact(repositoryId = TRTS_SNAPSHOTS, id = "org.carlspring.strongbox:timestamped", versions = { "2.0-20190626.190020-1", "2.0-20190626.190145-2"}) List<Path> artifactPaths) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); RepositoryPath artifactVersionBasePath = (RepositoryPath) artifactPaths.get(1).getParent().normalize(); artifactMetadataService.rebuildMetadata(storageId, repositoryId, "org/carlspring/strongbox/timestamped"); try (Stream<Path> pathStream = Files.walk(artifactVersionBasePath)) { long timestampedSnapshots = pathStream.filter(path -> path.toString().endsWith(".jar")).count(); assertEquals(2, timestampedSnapshots, "Amount of timestamped snapshots doesn't equal 2."); } SimpleDateFormat formatter = new SimpleDateFormat(TIMESTAMP_FORMAT); <START> Date keepDate = formatter.parse("20190625.190145"); <END> mavenRepositoryFeatures.removeTimestampedSnapshots(storageId, repositoryId, "org/carlspring/strongbox/timestamped", 0, keepDate); Path repositoryPath = repositoryPathResolver.resolve(repository); try (Stream<Path> pathStream = Files.walk(repositoryPath)) { long timestampedSnapshots = pathStream.filter(path -> path.toString().endsWith(".jar")).count(); assertEquals(0, timestampedSnapshots, "Amount of timestamped snapshots doesn't equal 0."); Path snapshotArtifactPath = getSnapshotArtifactPath(repositoryPath); assertNull(snapshotArtifactPath); } }</code><technical_language>original test logic keepDate following: Date keepDate = Date.from(LocalDate.now().minusDays(5).atStartOfDay(ZoneId.systemDefault()).toInstant())</technical_language>

Target:
public void testRemoveTimestampedSnapshotsWithPreviousDate(@MavenRepository(repositoryId = TRTS_SNAPSHOTS, policy = RepositoryPolicyEnum.SNAPSHOT) Repository repository, @MavenTestArtifact(repositoryId = TRTS_SNAPSHOTS, id = "org.carlspring.strongbox:timestamped", versions = { "2.0-20190626.190020-1", "2.0-20190626.190145-2"}) List<Path> artifactPaths) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); RepositoryPath artifactVersionBasePath = (RepositoryPath) artifactPaths.get(1).getParent().normalize(); artifactMetadataService.rebuildMetadata(storageId, repositoryId, "org/carlspring/strongbox/timestamped"); try (Stream<Path> pathStream = Files.walk(artifactVersionBasePath)) { long timestampedSnapshots = pathStream.filter(path -> path.toString().endsWith(".jar")).count(); assertEquals(2, timestampedSnapshots, "Amount of timestamped snapshots doesn't equal 2."); } SimpleDateFormat formatter = new SimpleDateFormat(MavenSnapshotManager.TIMESTAMP_FORMAT); Date keepDate = Date.from(LocalDate.now().minusDays(5).atStartOfDay(ZoneId.systemDefault()).toInstant()); mavenRepositoryFeatures.removeTimestampedSnapshots(storageId, repositoryId, "org/carlspring/strongbox/timestamped", 0, keepDate); Path repositoryPath = repositoryPathResolver.resolve(repository); try (Stream<Path> pathStream = Files.walk(repositoryPath)) { long timestampedSnapshots = pathStream.filter(path -> path.toString().endsWith(".jar")).count(); assertEquals(0, timestampedSnapshots, "Amount of timestamped snapshots doesn't equal 0."); Path snapshotArtifactPath = getSnapshotArtifactPath(repositoryPath); assertNull(snapshotArtifactPath); } }