RestoreSnapshotTaskRunner extends AbstractSnapshotTaskRunner { protected void addRestoreIdToSpaceProps(String restoreSpaceId, String restoreId) { Map<String, String> restoreSpaceProps = snapshotProvider.getSpaceProperties(restoreSpaceId); restoreSpaceProps.put(Constants.RESTORE_ID_PROP, restoreId); unwrappedSnapshotProvider.setNewSpaceProperties(restoreSpaceId, restoreSpaceProps); } RestoreSnapshotTaskRunner(StorageProvider snapshotProvider,
                                     SnapshotStorageProvider unwrappedSnapshotProvider,
                                     String dcHost,
                                     String dcPort,
                                     String dcStoreId,
                                     String dcSnapshotUser,
                                     String bridgeAppHost,
                                     String bridgeAppPort,
                                     String bridgeAppUser,
                                     String bridgeAppPass); @Override String getName(); @Override String performTask(String taskParameters);  }
@Test public void testAddRestoreIdToSpaceProps() throws Exception { String restoreSpaceId = "restore-space-id"; String restoreId = "restore-id"; Map<String, String> spaceProps = new HashMap<>(); EasyMock.expect(snapshotProvider.getSpaceProperties(restoreSpaceId)) .andReturn(spaceProps); Capture<Map<String, String>> propsCapture = new Capture<>(); unwrappedSnapshotProvider.setNewSpaceProperties(EasyMock.eq(restoreSpaceId), EasyMock.capture(propsCapture)); EasyMock.expectLastCall().once(); replayMocks(); taskRunner.addRestoreIdToSpaceProps(restoreSpaceId, restoreId); Map<String, String> updatedSpaceProps = propsCapture.getValue(); assertEquals(String.valueOf(restoreId), updatedSpaceProps.get(Constants.RESTORE_ID_PROP)); }