GetSnapshotContentBridgeResult extends BaseDTO { public String serialize() { JaxbJsonSerializer<GetSnapshotContentBridgeResult> serializer = new JaxbJsonSerializer<>(GetSnapshotContentBridgeResult.class); try { return serializer.serialize(this); } catch (IOException e) { throw new SnapshotDataException("Unable to create bridge result due to: " + e.getMessage()); } }  List<SnapshotContentItem> getContentItems(); void setContentItems(List<SnapshotContentItem> contentItems); Long getTotalCount(); void setTotalCount(Long totalCount); String serialize(); static GetSnapshotContentBridgeResult deserialize(String bridgeResult);  }
@Test public void testSerialize() { GetSnapshotContentBridgeResult bridgeResult = new GetSnapshotContentBridgeResult(); List<SnapshotContentItem> contentItemList = new ArrayList<>(); SnapshotContentItem contentItem = new SnapshotContentItem(); contentItem.setContentId(contentId); Map<String, String> contentProperties = new HashMap<>(); contentProperties.put(propName, propValue); contentItem.setContentProperties(contentProperties); contentItemList.add(contentItem); bridgeResult.setContentItems(contentItemList); bridgeResult.setTotalCount(totalCount); String result = bridgeResult.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"contentId\":\"" + contentId + "\"")); assertThat(cleanResult, containsString("\"" + propName + "\":\"" + propValue + "\"")); assertThat(cleanResult, containsString("\"totalCount\":" + totalCount)); }