@Test public void testGetScientificName() { ScientificName actual = null; Object returned = null; ETLStatistics etlStatistics = new ETLStatistics(); NsrTaxonTransformer nsrTaxonTransformer = new NsrTaxonTransformer(etlStatistics); NsrTaxon nsrTaxon = nsrTaxa.get(0); Name name = nsrTaxon.getNames()[0]; returned = ReflectionUtil.call(nsrTaxonTransformer, "getScientificName", new Class[]{Name.class}, name); actual = (ScientificName) returned; String expectedAuthorName = "Pontoppidan"; String expectedFullScintificName = "Larus argentatus argentatus Pontoppidan, 1763"; String expectedGenusOrMonomial = "Larus"; String expectedScientificNameGroup = "larus argentatus argentatus"; String expectedSpecificEpithet = "argentatus"; String expectedInfraspecificEpithet = "argentatus"; String expectedAuthorshipVerbatim = "Pontoppidan, 1763"; String expectedYear = "1763"; assertNotNull("01", actual); assertEquals("02", expectedAuthorName, actual.getAuthor()); assertEquals("03", expectedFullScintificName, actual.getFullScientificName()); assertEquals("04", expectedGenusOrMonomial, actual.getGenusOrMonomial()); assertEquals("05", expectedScientificNameGroup, actual.getScientificNameGroup()); assertEquals("06", expectedSpecificEpithet, actual.getSpecificEpithet()); assertEquals("07", expectedInfraspecificEpithet, actual.getInfraspecificEpithet()); assertEquals("08", expectedAuthorshipVerbatim, actual.getAuthorshipVerbatim()); assertEquals("09", expectedYear, actual.getYear()); }
private ScientificName getScientificName(Name name) { ScientificName sn = new ScientificName(); sn.setFullScientificName(val(name.getFullname())); sn.setAuthor(val(name.getName_author())); sn.setYear(val(name.getAuthorship_year())); sn.setAuthorshipVerbatim(val(name.getAuthorship())); sn.setGenusOrMonomial(val(name.getUninomial())); sn.setSpecificEpithet(val(name.getSpecific_epithet())); sn.setInfraspecificEpithet(val(name.getInfra_specific_epithet())); sn.setTaxonomicStatus(getTaxonomicStatus(name)); String author = val(name.getReference_author()); String title = val(name.getReference_title()); if (author != null || title != null) { Reference ref = new Reference(); ref.setTitleCitation(title); if (author != null) { ref.setAuthor(new Person(author)); } ref.setPublicationDate(getReferenceDate(name)); sn.setReferences(Collections.singletonList(ref)); } setScientificNameGroup(sn); return sn; }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private ScientificName getScientificName(Name name) { ScientificName sn = new ScientificName(); sn.setFullScientificName(val(name.getFullname())); sn.setAuthor(val(name.getName_author())); sn.setYear(val(name.getAuthorship_year())); sn.setAuthorshipVerbatim(val(name.getAuthorship())); sn.setGenusOrMonomial(val(name.getUninomial())); sn.setSpecificEpithet(val(name.getSpecific_epithet())); sn.setInfraspecificEpithet(val(name.getInfra_specific_epithet())); sn.setTaxonomicStatus(getTaxonomicStatus(name)); String author = val(name.getReference_author()); String title = val(name.getReference_title()); if (author != null || title != null) { Reference ref = new Reference(); ref.setTitleCitation(title); if (author != null) { ref.setAuthor(new Person(author)); } ref.setPublicationDate(getReferenceDate(name)); sn.setReferences(Collections.singletonList(ref)); } setScientificNameGroup(sn); return sn; } }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private ScientificName getScientificName(Name name) { ScientificName sn = new ScientificName(); sn.setFullScientificName(val(name.getFullname())); sn.setAuthor(val(name.getName_author())); sn.setYear(val(name.getAuthorship_year())); sn.setAuthorshipVerbatim(val(name.getAuthorship())); sn.setGenusOrMonomial(val(name.getUninomial())); sn.setSpecificEpithet(val(name.getSpecific_epithet())); sn.setInfraspecificEpithet(val(name.getInfra_specific_epithet())); sn.setTaxonomicStatus(getTaxonomicStatus(name)); String author = val(name.getReference_author()); String title = val(name.getReference_title()); if (author != null || title != null) { Reference ref = new Reference(); ref.setTitleCitation(title); if (author != null) { ref.setAuthor(new Person(author)); } ref.setPublicationDate(getReferenceDate(name)); sn.setReferences(Collections.singletonList(ref)); } setScientificNameGroup(sn); return sn; } NsrTaxonTransformer(ETLStatistics stats); }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private ScientificName getScientificName(Name name) { ScientificName sn = new ScientificName(); sn.setFullScientificName(val(name.getFullname())); sn.setAuthor(val(name.getName_author())); sn.setYear(val(name.getAuthorship_year())); sn.setAuthorshipVerbatim(val(name.getAuthorship())); sn.setGenusOrMonomial(val(name.getUninomial())); sn.setSpecificEpithet(val(name.getSpecific_epithet())); sn.setInfraspecificEpithet(val(name.getInfra_specific_epithet())); sn.setTaxonomicStatus(getTaxonomicStatus(name)); String author = val(name.getReference_author()); String title = val(name.getReference_title()); if (author != null || title != null) { Reference ref = new Reference(); ref.setTitleCitation(title); if (author != null) { ref.setAuthor(new Person(author)); } ref.setPublicationDate(getReferenceDate(name)); sn.setReferences(Collections.singletonList(ref)); } setScientificNameGroup(sn); return sn; } NsrTaxonTransformer(ETLStatistics stats);  }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private ScientificName getScientificName(Name name) { ScientificName sn = new ScientificName(); sn.setFullScientificName(val(name.getFullname())); sn.setAuthor(val(name.getName_author())); sn.setYear(val(name.getAuthorship_year())); sn.setAuthorshipVerbatim(val(name.getAuthorship())); sn.setGenusOrMonomial(val(name.getUninomial())); sn.setSpecificEpithet(val(name.getSpecific_epithet())); sn.setInfraspecificEpithet(val(name.getInfra_specific_epithet())); sn.setTaxonomicStatus(getTaxonomicStatus(name)); String author = val(name.getReference_author()); String title = val(name.getReference_title()); if (author != null || title != null) { Reference ref = new Reference(); ref.setTitleCitation(title); if (author != null) { ref.setAuthor(new Person(author)); } ref.setPublicationDate(getReferenceDate(name)); sn.setReferences(Collections.singletonList(ref)); } setScientificNameGroup(sn); return sn; } NsrTaxonTransformer(ETLStatistics stats);   }