@Test public void testGetVernacularName() { VernacularName actual = null; Object returned = null; ETLStatistics etlStatistics = new ETLStatistics(); NsrTaxonTransformer nsrTaxonTransformer = new NsrTaxonTransformer(etlStatistics); NsrTaxon nsrTaxon = nsrTaxa.get(0); Name vernacularName = null; for (Name name : nsrTaxon.getNames()) { if (name.getNametype().equals("isPreferredNameOf")) vernacularName = name; } returned = ReflectionUtil.call(nsrTaxonTransformer, "getVernacularName", new Class[]{Name.class}, vernacularName); actual = (VernacularName) returned; String expectedName = "Scandinavische zilvermeeuw"; boolean isPreffered = true; String expectedLanguage = "Dutch"; assertNotNull("01", actual); assertEquals("02", expectedName, actual.getName()); assertEquals("03", isPreffered, actual.getPreferred()); assertEquals("04", expectedLanguage, actual.getLanguage()); }
private VernacularName getVernacularName(Name name) { VernacularName vn = new VernacularName(); vn.setLanguage(val(name.getLanguage())); vn.setName(val(name.getFullname())); String nameType = val(name.getNametype()); vn.setPreferred(nameType.equals("isPreferredNameOf")); 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)); vn.setReferences(Collections.singletonList(ref)); } return vn; }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private VernacularName getVernacularName(Name name) { VernacularName vn = new VernacularName(); vn.setLanguage(val(name.getLanguage())); vn.setName(val(name.getFullname())); String nameType = val(name.getNametype()); vn.setPreferred(nameType.equals("isPreferredNameOf")); 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)); vn.setReferences(Collections.singletonList(ref)); } return vn; } }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private VernacularName getVernacularName(Name name) { VernacularName vn = new VernacularName(); vn.setLanguage(val(name.getLanguage())); vn.setName(val(name.getFullname())); String nameType = val(name.getNametype()); vn.setPreferred(nameType.equals("isPreferredNameOf")); 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)); vn.setReferences(Collections.singletonList(ref)); } return vn; } NsrTaxonTransformer(ETLStatistics stats); }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private VernacularName getVernacularName(Name name) { VernacularName vn = new VernacularName(); vn.setLanguage(val(name.getLanguage())); vn.setName(val(name.getFullname())); String nameType = val(name.getNametype()); vn.setPreferred(nameType.equals("isPreferredNameOf")); 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)); vn.setReferences(Collections.singletonList(ref)); } return vn; } NsrTaxonTransformer(ETLStatistics stats);  }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private VernacularName getVernacularName(Name name) { VernacularName vn = new VernacularName(); vn.setLanguage(val(name.getLanguage())); vn.setName(val(name.getFullname())); String nameType = val(name.getNametype()); vn.setPreferred(nameType.equals("isPreferredNameOf")); 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)); vn.setReferences(Collections.singletonList(ref)); } return vn; } NsrTaxonTransformer(ETLStatistics stats);   }