RestoreSnapshotTaskResult extends CreateRestoreBridgeResult { public String serialize() { JaxbJsonSerializer<RestoreSnapshotTaskResult> serializer = new JaxbJsonSerializer<>(RestoreSnapshotTaskResult.class); try { return serializer.serialize(this); } catch (IOException e) { throw new SnapshotDataException( "Unable to create task result due to: " + e.getMessage()); } }  String getSpaceId(); void setSpaceId(String spaceId); String serialize(); static RestoreSnapshotTaskResult deserialize(String taskResult);  }
@Test public void testSerialize() { String spaceId = "space-id"; String restoreId = "restore-id"; RestoreStatus status = RestoreStatus.INITIALIZED; RestoreSnapshotTaskResult taskResult = new RestoreSnapshotTaskResult(); taskResult.setSpaceId(spaceId); taskResult.setRestoreId(restoreId); taskResult.setStatus(status); String result = taskResult.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"spaceId\":\"" + spaceId + "\"")); assertThat(cleanResult, containsString("\"restoreId\":\"" + restoreId + "\"")); assertThat(cleanResult, containsString("\"status\":\"" + status + "\"")); }