RestoreSnapshotTaskRunner extends AbstractSnapshotTaskRunner { protected String buildBridgeBody(String spaceId, String snapshotId, String userEmail) { CreateRestoreBridgeParameters bridgeParams = new CreateRestoreBridgeParameters(dcHost, dcPort, dcStoreId, spaceId, snapshotId, userEmail); return bridgeParams.serialize(); } 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 testBuildBridgeBody() { replayMocks(); String spaceId = "space-id"; String snapshotId = "snapshot-id"; String userEmail = "user-email"; String result = taskRunner.buildBridgeBody(spaceId, snapshotId, userEmail); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"host\":\"" + dcHost + "\"")); assertThat(cleanResult, containsString("\"port\":\"" + dcPort + "\"")); assertThat(cleanResult, containsString("\"storeId\":\"" + dcStoreId + "\"")); assertThat(cleanResult, containsString("\"spaceId\":\"" + spaceId + "\"")); assertThat(cleanResult, containsString("\"snapshotId\":\"" + snapshotId + "\"")); assertThat(cleanResult, containsString("\"userEmail\":\"" + userEmail + "\"")); }