@Test public void testExtractNamesFromMultiMedia() { ScientificName scientificName = new ScientificName(); scientificName.setFullScientificName("Bombus affinis Cresson, 1863"); scientificName.setScientificNameGroup("bombus affinis"); MultiMediaContentIdentification mmci = new MultiMediaContentIdentification(); mmci.setScientificName(scientificName); List<MultiMediaContentIdentification> list = new ArrayList<>(); list.add(mmci); MultiMediaObject mmo = new MultiMediaObject(); mmo.setIdentifications(list); List<MultiMediaObject> mmoList = new ArrayList<>(); mmoList.add(mmo); Object actual = ReflectionUtil.callStatic(EnrichmentUtil.class, "extractNamesFromMultiMedia", new Class[] {List.class}, new Object[] {mmoList}); String[] resultArray = (String[]) actual; String expectedName = "bombus affinis"; assertNotNull("01", resultArray); assertEquals("01", expectedName, resultArray[0]); }
private static String[] extractNamesFromMultiMedia(List<MultiMediaObject> multimedia) { HashSet<String> names = new HashSet<>(multimedia.size() * 3); for (MultiMediaObject m : multimedia) { for (MultiMediaContentIdentification identification : m.getIdentifications()) { names.add(identification.getScientificName().getScientificNameGroup()); } } return names.toArray(new String[names.size()]); }
EnrichmentUtil { private static String[] extractNamesFromMultiMedia(List<MultiMediaObject> multimedia) { HashSet<String> names = new HashSet<>(multimedia.size() * 3); for (MultiMediaObject m : multimedia) { for (MultiMediaContentIdentification identification : m.getIdentifications()) { names.add(identification.getScientificName().getScientificNameGroup()); } } return names.toArray(new String[names.size()]); } }
EnrichmentUtil { private static String[] extractNamesFromMultiMedia(List<MultiMediaObject> multimedia) { HashSet<String> names = new HashSet<>(multimedia.size() * 3); for (MultiMediaObject m : multimedia) { for (MultiMediaContentIdentification identification : m.getIdentifications()) { names.add(identification.getScientificName().getScientificNameGroup()); } } return names.toArray(new String[names.size()]); }  }
EnrichmentUtil { private static String[] extractNamesFromMultiMedia(List<MultiMediaObject> multimedia) { HashSet<String> names = new HashSet<>(multimedia.size() * 3); for (MultiMediaObject m : multimedia) { for (MultiMediaContentIdentification identification : m.getIdentifications()) { names.add(identification.getScientificName().getScientificNameGroup()); } } return names.toArray(new String[names.size()]); }  static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa); }
EnrichmentUtil { private static String[] extractNamesFromMultiMedia(List<MultiMediaObject> multimedia) { HashSet<String> names = new HashSet<>(multimedia.size() * 3); for (MultiMediaObject m : multimedia) { for (MultiMediaContentIdentification identification : m.getIdentifications()) { names.add(identification.getScientificName().getScientificNameGroup()); } } return names.toArray(new String[names.size()]); }  static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa);  }