use of ubic.gemma.model.common.description.Keyword in project Gemma by PavlidisLab.
the class PubMedXMLParserTest method testParseMulti.
/*
* This uses a medline-format file, instead of the pubmed xml files we get from the eutils.
*/
@Test
public void testParseMulti() throws Exception {
try {
testStream = new GZIPInputStream(PubMedXMLParserTest.class.getResourceAsStream("/data/loader/medline.multi.xml.gz"));
Collection<BibliographicReference> brl = testParser.parse(testStream);
assertEquals(147, brl.size());
int expectedNumberofKeywords = 258;
int expectedNumberofCompounds = 46;
int actualNumberofKeywords = 0;
int actualNumberofCompounds = 0;
for (BibliographicReference reference : brl) {
assertNotNull(reference.getPublicationDate());
Collection<Keyword> keywords = reference.getKeywords();
for (Keyword keyword : keywords) {
assertNotNull(keyword.getTerm());
// log.info( keyword.getTerm() );
actualNumberofKeywords++;
}
for (Compound c : reference.getChemicals()) {
assertNotNull(c.getName());
// log.info( c.getName() );
actualNumberofCompounds++;
}
assertTrue(reference.getPublicationTypes().size() > 0);
}
assertEquals(expectedNumberofKeywords, actualNumberofKeywords);
assertEquals(expectedNumberofCompounds, actualNumberofCompounds);
} catch (RuntimeException e) {
this.logOrThrowException(e);
}
}
Aggregations