AtomFeedXmlReader implements AtomFeedReader { public final AtomEntry<Node> readAtomEntry(final InputStream in) { final Document doc = parseDocument(createDocumentBuilder(), in); final XPath xPath = createXPath("atom", "http: final String eventStreamId = findContentText(doc, xPath, "/atom:entry/atom:content/eventStreamId"); final Integer eventNumber = findContentInteger(doc, xPath, "/atom:entry/atom:content/eventNumber"); final String eventType = findContentText(doc, xPath, "/atom:entry/atom:content/eventType"); final String eventId = findContentText(doc, xPath, "/atom:entry/atom:content/eventId"); final Node escMetaNode = findNode(doc, xPath, "/atom:entry/atom:content/metadata/esc-meta"); final String dataContextTypeStr = findContentText(escMetaNode, xPath, "data-content-type"); final EnhancedMimeType dataContentType = EnhancedMimeType.create(dataContextTypeStr); final Node data = findNode(doc, xPath, "/atom:entry/atom:content/data"); final EnhancedMimeType metaContentType; final String metaTypeStr; final Node meta; if (hasMetaData(escMetaNode)) { final String metaContentTypeStr = findContentText(escMetaNode, xPath, "meta-content-type"); metaContentType = EnhancedMimeType.create(metaContentTypeStr); metaTypeStr = findContentText(escMetaNode, xPath, "meta-type"); meta = escMetaNode; } else { metaContentType = null; metaTypeStr = null; meta = null; } return new AtomEntry<Node>(eventStreamId, eventNumber, eventType, eventId, dataContentType, metaContentType, metaTypeStr, data, meta); }  @Override final List<URI> readAtomFeed(final InputStream in); @Override final CommonEvent readEvent(final DeserializerRegistry desRegistry, final InputStream in); final AtomEntry<Node> readAtomEntry(final InputStream in);  }
@Test public void testReadAtomEntryContent() throws IOException, SAXException { final AtomFeedXmlReader testee = new AtomFeedXmlReader(); final InputStream in = this.getClass().getResourceAsStream("/atom-feed-event-0.xml"); try { final AtomEntry<?> entry = testee.readAtomEntry(in); assertThat(entry.getEventStreamId()).isEqualTo("MyStreamA"); assertThat(entry.getEventNumber()).isEqualTo(0); assertThat(entry.getEventType()).isEqualTo("MyEvent"); assertThat(entry.getEventId()).isEqualTo("8faef866-b80f-4952-9124-62819a6517aa"); assertThat(entry.getDataContentType()).isEqualTo( EnhancedMimeType.create("application/xml; version=1; encoding=utf-8")); assertThat(entry.getMetaContentType()).isEqualTo( EnhancedMimeType.create("application/xml; version=1; encoding=utf-8")); assertThat(entry.getData()).isInstanceOf(Node.class); assertThat(entry.getMeta()).isInstanceOf(Node.class); } finally { in.close(); } }