CompleteSnapshotTaskRunner implements TaskRunner { @Override public String performTask(String taskParameters) { CompleteSnapshotTaskParameters taskParams = CompleteSnapshotTaskParameters.deserialize(taskParameters); String spaceId = taskParams.getSpaceId(); String bucketName = unwrappedSnapshotProvider.getBucketName(spaceId); log.info("Performing Complete Snapshot Task for spaceID: " + spaceId); s3Client.deleteBucketLifecycleConfiguration(bucketName); unwrappedSnapshotProvider .setNewSpaceProperties(spaceId, new HashMap<String, String>()); log.info("Complete Snapshot Task for space " + spaceId + " completed successfully"); String result = "Snapshot complete was successful"; return new CompleteSnapshotTaskResult(result).serialize(); } CompleteSnapshotTaskRunner(StorageProvider snapshotProvider,
                                      SnapshotStorageProvider unwrappedSnapshotProvider,
                                      AmazonS3 s3Client); @Override String getName(); @Override String performTask(String taskParameters);  }
@Test public void testPerformTask() { String spaceId = "space-id"; String bucketName = "bucket-name"; EasyMock.expect(unwrappedSnapshotProvider.getBucketName(spaceId)) .andReturn(bucketName); s3Client.deleteBucketLifecycleConfiguration(EasyMock.eq(bucketName)); EasyMock.expectLastCall().once(); unwrappedSnapshotProvider.setNewSpaceProperties(EasyMock.eq(spaceId), EasyMock.isA(Map.class)); EasyMock.expectLastCall().once(); replayMocks(); taskRunner.performTask("{\"spaceId\":\"" + spaceId + "\"}"); }