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