CreateSnapshotTaskRunner extends SpaceModifyingSnapshotTaskRunner { protected String buildSnapshotBody(CreateSnapshotTaskParameters taskParams) { CreateSnapshotBridgeParameters bridgeParams = new CreateSnapshotBridgeParameters(dcHost, dcPort, dcStoreId, taskParams.getSpaceId(), taskParams.getDescription(), taskParams.getUserEmail(), bridgeMemberId); return bridgeParams.serialize(); } CreateSnapshotTaskRunner(StorageProvider snapshotProvider,
                                    SnapshotStorageProvider unwrappedSnapshotProvider,
                                    String dcHost,
                                    String dcPort,
                                    String dcStoreId,
                                    String dcAccountName,
                                    String dcSnapshotUser,
                                    String bridgeAppHost,
                                    String bridgeAppPort,
                                    String bridgeAppUser,
                                    String bridgeAppPass,
                                    String bridgeMemberId); @Override String getName(); @Override String performTask(String taskParameters);  }
@Test public void testBuildSnapshotBody() { replayMocks(); String spaceId = "space-id"; String description = "description"; String userEmail = "user-email"; CreateSnapshotTaskParameters taskParams = new CreateSnapshotTaskParameters(); taskParams.setSpaceId(spaceId); taskParams.setDescription(description); taskParams.setUserEmail(userEmail); String result = taskRunner.buildSnapshotBody(taskParams); 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("\"description\":\"" + description + "\"")); assertThat(cleanResult, containsString("\"userEmail\":\"" + userEmail + "\"")); assertThat(cleanResult, containsString("\"memberId\":\"" + bridgeMemberId + "\"")); }