[downloadsAndViews]update the test file to consider the new serialization for downloads and views

This commit is contained in:
Miriam Baglioni 2024-06-05 16:30:15 +02:00
parent bf9a5e6314
commit c4d9b5b9d2
1 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import java.io.StringReader;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.commons.math3.optim.AbstractOptimizationProblem;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
@ -42,6 +43,7 @@ public class XmlRecordFactoryTest {
final Publication p = OBJECT_MAPPER
.readValue(IOUtils.toString(getClass().getResourceAsStream("publication.json")), Publication.class);
final String xml = xmlRecordFactory.build(new JoinedEntity(p));
assertNotNull(xml);
@ -51,7 +53,12 @@ public class XmlRecordFactoryTest {
assertNotNull(doc);
// System.out.println(doc.asXML());
System.out.println(doc.asXML());
assertEquals("10", doc.valueOf("//measure[@id = 'downloads']/@count"));
assertEquals("fakeds", doc.valueOf("//measure[@id = 'downloads']/@datasource"));
assertEquals(0, doc.selectNodes("//measure[@id = 'views']").size());
assertEquals("0000-0001-9613-6638", doc.valueOf("//creator[@rank = '1']/@orcid"));
assertEquals("0000-0001-9613-6639", doc.valueOf("//creator[@rank = '1']/@orcid_pending"));