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