use of org.nextprot.api.web.service.impl.writer.EntryXMLStreamWriter in project nextprot-api by calipho-sib.
the class ExportXMLHeaderTest method testXMLExportHeaderRelease.
@Test
public void testXMLExportHeaderRelease() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Writer writer = new PrintWriter(out);
EntryVelocityBasedStreamWriter exporter = new EntryXMLStreamWriter(writer, "overview");
ReleaseInfoVersions rc = new ReleaseInfoVersions();
rc.setApiRelease("api-test-version");
rc.setDatabaseRelease("database-test-version");
Map<String, Object> infos = new HashMap<>();
infos.put(EntryStreamWriter.getReleaseInfoKey(), rc);
exporter.write(Collections.emptyList(), infos);
NodeList dbReleaseNodes = XMLUnitUtils.getMatchingNodes(out.toString(), "//*[local-name()='database-release']");
assertEquals("database-test-version", dbReleaseNodes.item(0).getTextContent());
NodeList apiReleaseNodes = XMLUnitUtils.getMatchingNodes(out.toString(), "//*[local-name()='api-release']");
assertEquals("api-test-version", apiReleaseNodes.item(0).getTextContent());
NodeList entriesCountNode = XMLUnitUtils.getMatchingNodes(out.toString(), "//*[local-name()='number-of-entries']");
assertEquals("0", entriesCountNode.item(0).getTextContent());
}
Aggregations