@Test public void testSerializeAndDeserialize() throws Exception { int position = 1; String rawText = "citation raw text"; String idValue = "val"; String idType = "type"; float confidenceLevel = 0.9f; List<TypedId> identifiers = new ArrayList<>(); identifiers.add(new TypedId(idValue, idType, confidenceLevel)); BlobCitationEntry entry = new BlobCitationEntry(); entry.setPosition(position); entry.setRawText(rawText); entry.setIdentifiers(identifiers); SortedSet<BlobCitationEntry> entrySet = new TreeSet<>(); entrySet.add(entry); String resultStr = converter.serialize(entrySet); SortedSet<BlobCitationEntry> resultSet = converter.deserialize(resultStr); assertNotNull(resultSet); assertEquals(1, resultSet.size()); BlobCitationEntry resultEntry = resultSet.first(); assertNotNull(resultEntry); assertEquals(position, resultEntry.getPosition()); assertEquals(rawText, resultEntry.getRawText()); assertNotNull(resultEntry.getIdentifiers()); assertEquals(1, resultEntry.getIdentifiers().size()); TypedId resultId = resultEntry.getIdentifiers().get(0); assertEquals(idValue, resultId.getValue()); assertEquals(idType, resultId.getType()); assertEquals(confidenceLevel, resultId.getConfidenceLevel(), 0.001f); }
@SuppressWarnings("unchecked") @Override public SortedSet<BlobCitationEntry> deserialize(String source) throws UnsupportedOperationException { return (SortedSet<BlobCitationEntry>) getXstream().fromXML(source); }
CitationsExtraInfoConverter extends AbstractExtraInfoConverter<SortedSet<BlobCitationEntry>> { @SuppressWarnings("unchecked") @Override public SortedSet<BlobCitationEntry> deserialize(String source) throws UnsupportedOperationException { return (SortedSet<BlobCitationEntry>) getXstream().fromXML(source); } }
CitationsExtraInfoConverter extends AbstractExtraInfoConverter<SortedSet<BlobCitationEntry>> { @SuppressWarnings("unchecked") @Override public SortedSet<BlobCitationEntry> deserialize(String source) throws UnsupportedOperationException { return (SortedSet<BlobCitationEntry>) getXstream().fromXML(source); } CitationsExtraInfoConverter(); }
CitationsExtraInfoConverter extends AbstractExtraInfoConverter<SortedSet<BlobCitationEntry>> { @SuppressWarnings("unchecked") @Override public SortedSet<BlobCitationEntry> deserialize(String source) throws UnsupportedOperationException { return (SortedSet<BlobCitationEntry>) getXstream().fromXML(source); } CitationsExtraInfoConverter(); @SuppressWarnings("unchecked") @Override SortedSet<BlobCitationEntry> deserialize(String source); }
CitationsExtraInfoConverter extends AbstractExtraInfoConverter<SortedSet<BlobCitationEntry>> { @SuppressWarnings("unchecked") @Override public SortedSet<BlobCitationEntry> deserialize(String source) throws UnsupportedOperationException { return (SortedSet<BlobCitationEntry>) getXstream().fromXML(source); } CitationsExtraInfoConverter(); @SuppressWarnings("unchecked") @Override SortedSet<BlobCitationEntry> deserialize(String source);  }