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