RestoreSnapshotTaskParameters extends BaseDTO { public String serialize() { JaxbJsonSerializer<RestoreSnapshotTaskParameters> serializer = new JaxbJsonSerializer<>(RestoreSnapshotTaskParameters.class); try { return serializer.serialize(this); } catch (IOException e) { throw new SnapshotDataException( "Unable to create task parameters due to: " + e.getMessage()); } }  String getSnapshotId(); void setSnapshotId(String snapshotId); String getUserEmail(); void setUserEmail(String userEmail); String serialize(); static RestoreSnapshotTaskParameters deserialize(String taskParameters);  }
@Test public void testSerialize() { String snapshotId = "snapshot-id"; String userEmail = "user-email"; RestoreSnapshotTaskParameters taskParams = new RestoreSnapshotTaskParameters(); taskParams.setSnapshotId(snapshotId); taskParams.setUserEmail(userEmail); String result = taskParams.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"snapshotId\":\"" + snapshotId + "\"")); assertThat(cleanResult, containsString("\"userEmail\":\"" + userEmail + "\"")); }