GetSnapshotHistoryBridgeResult extends BaseDTO { public String serialize() { JaxbJsonSerializer<GetSnapshotHistoryBridgeResult> serializer = new JaxbJsonSerializer<>(GetSnapshotHistoryBridgeResult.class); try { return serializer.serialize(this); } catch (IOException e) { throw new SnapshotDataException("Unable to create bridge result due to: " + e.getMessage()); } }  List<SnapshotHistoryItem> getHistoryItems(); void setHistoryItems(List<SnapshotHistoryItem> historyItems); Long getTotalCount(); void setTotalCount(Long totalCount); String serialize(); static GetSnapshotHistoryBridgeResult deserialize(String bridgeResult);  }
@Test public void testSerialize() { GetSnapshotHistoryBridgeResult bridgeResult = new GetSnapshotHistoryBridgeResult(); List<SnapshotHistoryItem> historyItemList = new ArrayList<>(); SnapshotHistoryItem historyItem = new SnapshotHistoryItem(); historyItem.setHistory(history); historyItem.setHistoryDate(historyDate); historyItemList.add(historyItem); bridgeResult.setHistoryItems(historyItemList); bridgeResult.setTotalCount(totalCount); String result = bridgeResult.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"history\":\"" + history + "\"")); assertThat(cleanResult, containsString("\"historyDate\":" + historyDate.getTime() + "")); assertThat(cleanResult, containsString("\"totalCount\":" + totalCount)); }