@Test public void testCreateTaxonLookupTableForSpecimens() { ScientificName scientificName = new ScientificName(); scientificName.setFullScientificName("Bombus affinis Cresson, 1863"); scientificName.setScientificNameGroup("bombus affinis"); SpecimenIdentification identification = new SpecimenIdentification(); identification.setScientificName(scientificName); Specimen specimen = new Specimen(); specimen.addIndentification(identification); List<Specimen> specimens = new ArrayList<>(); specimens.add(specimen); Map<String, List<Taxon>> actual = EnrichmentUtil.createTaxonLookupTableForSpecimens(specimens); String actualKeyValue = null; if (actual.entrySet().size() > 0) { actualKeyValue = actual.entrySet().stream().map(i -> i.getKey()).findFirst().get(); } List<Taxon> taxonList = actual.get(actualKeyValue); String expectedKeyValue = "bombus affinis"; String expectedId = "6931870@COL"; String expectedScientificNameGroup = "bombus affinis"; String expectedAuthorshipVerbatim = "Cresson, 1863"; String expectedFullScientificName = "Bombus affinis Cresson, 1863"; assertEquals("01", expectedKeyValue, actualKeyValue); assertEquals("02", expectedId, taxonList.get(0).getId()); assertEquals("03", expectedScientificNameGroup, taxonList.get(0).getAcceptedName().getScientificNameGroup()); assertEquals("04", expectedFullScientificName, taxonList.get(0).getAcceptedName().getFullScientificName()); assertEquals("05", expectedAuthorshipVerbatim, taxonList.get(0).getAcceptedName().getAuthorshipVerbatim()); }
static Map<String, List<Taxon>> createTaxonLookupTableForSpecimens(List<Specimen> specimens) { String[] names = extractNamesFromSpecimens(specimens); if (logger.isDebugEnabled()) { String fmt = "{} unique scientific names extracted from {} specimens"; logger.debug(fmt, names.length, specimens.size()); } return createTaxonLookupTable(names); }
EnrichmentUtil { static Map<String, List<Taxon>> createTaxonLookupTableForSpecimens(List<Specimen> specimens) { String[] names = extractNamesFromSpecimens(specimens); if (logger.isDebugEnabled()) { String fmt = "{} unique scientific names extracted from {} specimens"; logger.debug(fmt, names.length, specimens.size()); } return createTaxonLookupTable(names); } }
EnrichmentUtil { static Map<String, List<Taxon>> createTaxonLookupTableForSpecimens(List<Specimen> specimens) { String[] names = extractNamesFromSpecimens(specimens); if (logger.isDebugEnabled()) { String fmt = "{} unique scientific names extracted from {} specimens"; logger.debug(fmt, names.length, specimens.size()); } return createTaxonLookupTable(names); }  }
EnrichmentUtil { static Map<String, List<Taxon>> createTaxonLookupTableForSpecimens(List<Specimen> specimens) { String[] names = extractNamesFromSpecimens(specimens); if (logger.isDebugEnabled()) { String fmt = "{} unique scientific names extracted from {} specimens"; logger.debug(fmt, names.length, specimens.size()); } return createTaxonLookupTable(names); }  static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa); }
EnrichmentUtil { static Map<String, List<Taxon>> createTaxonLookupTableForSpecimens(List<Specimen> specimens) { String[] names = extractNamesFromSpecimens(specimens); if (logger.isDebugEnabled()) { String fmt = "{} unique scientific names extracted from {} specimens"; logger.debug(fmt, names.length, specimens.size()); } return createTaxonLookupTable(names); }  static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa);  }