@SuppressWarnings("unchecked") @Test public void testGetIdentification() throws Exception { ETLStatistics etlStatistics = new ETLStatistics(); List<Taxon> list = null; MultiMediaContentIdentification actual = null; NsrExtractor extractor = new NsrExtractor(nsrFile, etlStatistics); NsrTaxonTransformer nsrTaxonTransformer = new NsrTaxonTransformer(etlStatistics); NsrMultiMediaTransformer mediaTransformer = new NsrMultiMediaTransformer(etlStatistics); for (XMLRecordInfo extracted : extractor) { CommonReflectionUtil.setField(AbstractTransformer.class, nsrTaxonTransformer, "objectID", "D3KF0JNQ0UA"); CommonReflectionUtil.setField(AbstractTransformer.class, nsrTaxonTransformer, "input", extracted); Object taxonObject = CommonReflectionUtil.callMethod(null, null, nsrTaxonTransformer, "doTransform"); CommonReflectionUtil.setField(AbstractTransformer.class, mediaTransformer, "objectID", "D3KF0JNQ0UA"); CommonReflectionUtil.setField(AbstractTransformer.class, mediaTransformer, "input", extracted); list = (List<Taxon>) taxonObject; mediaTransformer.setTaxon(list.get(0)); Object returned = CommonReflectionUtil.callMethod(null, null, mediaTransformer, "getIdentification"); actual = (MultiMediaContentIdentification) returned; } String expectedTaxonRank = "subspecies"; String expectedFullScientificName = "Larus argentatus argentatus Pontoppidan, 1763"; String expectedScientificNameGroup = "larus argentatus argentatus"; String expectedGenusOrMonomial = "Larus"; assertNotNull("01",actual); assertEquals("02",expectedTaxonRank, actual.getTaxonRank()); assertEquals("03",expectedFullScientificName, actual.getScientificName().getFullScientificName()); assertEquals("04",expectedScientificNameGroup, actual.getScientificName().getScientificNameGroup()); assertEquals("05",expectedGenusOrMonomial, actual.getScientificName().getGenusOrMonomial()); }
private MultiMediaContentIdentification getIdentification() { Taxon t = taxon; MultiMediaContentIdentification mmci = new MultiMediaContentIdentification(); mmci.setTaxonRank(t.getTaxonRank()); mmci.setScientificName(t.getAcceptedName()); mmci.setDefaultClassification(t.getDefaultClassification()); mmci.setVernacularNames(t.getVernacularNames()); return mmci; }
NsrMultiMediaTransformer extends AbstractJSONTransformer<MultiMediaObject> { private MultiMediaContentIdentification getIdentification() { Taxon t = taxon; MultiMediaContentIdentification mmci = new MultiMediaContentIdentification(); mmci.setTaxonRank(t.getTaxonRank()); mmci.setScientificName(t.getAcceptedName()); mmci.setDefaultClassification(t.getDefaultClassification()); mmci.setVernacularNames(t.getVernacularNames()); return mmci; } }
NsrMultiMediaTransformer extends AbstractJSONTransformer<MultiMediaObject> { private MultiMediaContentIdentification getIdentification() { Taxon t = taxon; MultiMediaContentIdentification mmci = new MultiMediaContentIdentification(); mmci.setTaxonRank(t.getTaxonRank()); mmci.setScientificName(t.getAcceptedName()); mmci.setDefaultClassification(t.getDefaultClassification()); mmci.setVernacularNames(t.getVernacularNames()); return mmci; } NsrMultiMediaTransformer(ETLStatistics stats); }
NsrMultiMediaTransformer extends AbstractJSONTransformer<MultiMediaObject> { private MultiMediaContentIdentification getIdentification() { Taxon t = taxon; MultiMediaContentIdentification mmci = new MultiMediaContentIdentification(); mmci.setTaxonRank(t.getTaxonRank()); mmci.setScientificName(t.getAcceptedName()); mmci.setDefaultClassification(t.getDefaultClassification()); mmci.setVernacularNames(t.getVernacularNames()); return mmci; } NsrMultiMediaTransformer(ETLStatistics stats); void setTaxon(Taxon taxon); }
NsrMultiMediaTransformer extends AbstractJSONTransformer<MultiMediaObject> { private MultiMediaContentIdentification getIdentification() { Taxon t = taxon; MultiMediaContentIdentification mmci = new MultiMediaContentIdentification(); mmci.setTaxonRank(t.getTaxonRank()); mmci.setScientificName(t.getAcceptedName()); mmci.setDefaultClassification(t.getDefaultClassification()); mmci.setVernacularNames(t.getVernacularNames()); return mmci; } NsrMultiMediaTransformer(ETLStatistics stats); void setTaxon(Taxon taxon);  }