### Question:
AwsRDSPlatform extends Platform { boolean snapshotIsOlderThan (String dbSnapshotName, int olderThanMinutes) { Matcher m = CalendarUtils.datePattern.matcher(dbSnapshotName); if (m.find()) { String dateSection = m.group(1); Instant snapshotTime = AwsRDSUtils.getInstantFromNameSegment(dateSection); log.debug("Calculated snapshot {} has a timestamp of {}", v(DataDogConstants.RDS_INSTANCE_SNAPSHOT, dbSnapshotName), v("snapshotTime", snapshotTime)); return snapshotTime.plus(Duration.ofMinutes(olderThanMinutes)).isBefore(Instant.now()); } log.warn("Could not extract a timestamp from {}.", v(DataDogConstants.RDS_INSTANCE_SNAPSHOT, dbSnapshotName)); return false; } @Autowired  AwsRDSPlatform();   AwsRDSPlatform(AmazonRDS amazonRDS, AmazonEC2 amazonEC2); Map<String, String> getVpcToSecurityGroupMap(); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); @Override List<Container> generateExperimentRoster(); @Override boolean isContainerRecycled(Container container); Map<String, String> getFilter(); void setFilter(Map<String, String> filter); void failoverCluster(String dbClusterIdentifier); void restartInstance(String... dbInstanceIdentifiers); Set<String> getClusterInstances(String dbClusterIdentifier); ContainerHealth getInstanceStatus(String... dbInstanceIdentifiers); void setVpcSecurityGroupIds(String dbInstanceIdentifier, String vpcSecurityGroupId); void setVpcSecurityGroupIds(String dbInstanceIdentifier, Collection<String> vpcSecurityGroupIds); ContainerHealth checkVpcSecurityGroupIds(String dbInstanceIdentifier, Collection<String> vpcSecurityGroupIds); Collection<String> getVpcSecurityGroupIds(String dbInstanceIdentifier); String getChaosSecurityGroup(String dbInstanceIdentifier); DBSnapshot snapshotDBInstance(String dbInstanceIdentifier); DBClusterSnapshot snapshotDBCluster(String dbClusterIdentifier); void deleteInstanceSnapshot(DBSnapshot dbSnapshot); void deleteClusterSnapshot(DBClusterSnapshot dbClusterSnapshot); boolean isInstanceSnapshotRunning(String dbInstanceIdentifier); boolean isClusterSnapshotRunning(String dbClusterIdentifier);  }### Answer:
@Test public void snapshotIsOlderThan () { int minutes = new Random().nextInt(23 * 60) + 30; Instant baseTime = Instant.now().minus(Duration.ofMinutes(minutes)).truncatedTo(ChronoUnit.MILLIS); Instant olderTime = baseTime.minus(Duration.ofMinutes(20)); Instant newerTime = baseTime.plus(Duration.ofMinutes(20)); String olderSnapshotName = String.format("ChaosSnapshot-%s-%s", randomUUID(), olderTime) .replaceAll(":", "-") .replaceAll(",", "-") .replaceAll("\\.", "-") .replaceAll("--", "-"); String newerSnapshotName = String.format("ChaosSnapshot-%s-%s", randomUUID(), newerTime) .replaceAll(":", "-") .replaceAll(",", "-") .replaceAll("\\.", "-") .replaceAll("--", "-"); String otherSnapshotName = randomUUID().toString(); assertTrue("This snapshot should be treated as old and deletable", awsRDSPlatform.snapshotIsOlderThan(olderSnapshotName, minutes)); assertTrue("This snapshot should be treated as old and deletable", awsRDSPlatform.snapshotIsOlderThan(olderSnapshotName .toLowerCase(), minutes)); assertFalse("This snapshot should be treated as new and not deletable", awsRDSPlatform.snapshotIsOlderThan(newerSnapshotName, minutes)); assertFalse("This snapshot should be treated as new and not deletable", awsRDSPlatform.snapshotIsOlderThan(newerSnapshotName .toLowerCase(), minutes)); assertFalse("This snapshot doesn't belong to Chaos and should not be deletable", awsRDSPlatform.snapshotIsOlderThan(otherSnapshotName, minutes)); assertFalse("This snapshot doesn't belong to Chaos and should not be deletable", awsRDSPlatform.snapshotIsOlderThan(otherSnapshotName .toLowerCase(), minutes)); }