@Test public void testExpandGenus() throws Exception { assertEquals(null, ExtensionInterpreter.expandGenus(null, "Abies alba")); assertEquals("", ExtensionInterpreter.expandGenus("", "Abies")); assertEquals("Abies alba", ExtensionInterpreter.expandGenus("Abies alba", "Abies negra")); assertEquals("Abies alba", ExtensionInterpreter.expandGenus("Abies alba", null)); assertEquals("Abies alba", ExtensionInterpreter.expandGenus("A alba", "Abies negra")); assertEquals("Abies alba", ExtensionInterpreter.expandGenus("A. alba", "Abies negra")); assertEquals("Abies alba", ExtensionInterpreter.expandGenus("A. alba", "Abies negra")); }
@VisibleForTesting protected static String expandGenus(String abbreviatedName, String scientificName) { if (abbreviatedName != null && abbreviatedName.length() > 1 && scientificName != null && scientificName.length() > 2) { String[] parts = abbreviatedName.split("\\s+", 2); String genus = scientificName.split("\\s+", 2)[0]; String abbrev = parts[0].replaceAll("\\.$", ""); if (parts.length == 2 && abbrev.length() < 4 && genus.startsWith(abbrev)) { return genus + " " + parts[1]; } } return abbreviatedName; }
ExtensionInterpreter { @VisibleForTesting protected static String expandGenus(String abbreviatedName, String scientificName) { if (abbreviatedName != null && abbreviatedName.length() > 1 && scientificName != null && scientificName.length() > 2) { String[] parts = abbreviatedName.split("\\s+", 2); String genus = scientificName.split("\\s+", 2)[0]; String abbrev = parts[0].replaceAll("\\.$", ""); if (parts.length == 2 && abbrev.length() < 4 && genus.startsWith(abbrev)) { return genus + " " + parts[1]; } } return abbreviatedName; } }
ExtensionInterpreter { @VisibleForTesting protected static String expandGenus(String abbreviatedName, String scientificName) { if (abbreviatedName != null && abbreviatedName.length() > 1 && scientificName != null && scientificName.length() > 2) { String[] parts = abbreviatedName.split("\\s+", 2); String genus = scientificName.split("\\s+", 2)[0]; String abbrev = parts[0].replaceAll("\\.$", ""); if (parts.length == 2 && abbrev.length() < 4 && genus.startsWith(abbrev)) { return genus + " " + parts[1]; } } return abbreviatedName; }  }
ExtensionInterpreter { @VisibleForTesting protected static String expandGenus(String abbreviatedName, String scientificName) { if (abbreviatedName != null && abbreviatedName.length() > 1 && scientificName != null && scientificName.length() > 2) { String[] parts = abbreviatedName.split("\\s+", 2); String genus = scientificName.split("\\s+", 2)[0]; String abbrev = parts[0].replaceAll("\\.$", ""); if (parts.length == 2 && abbrev.length() < 4 && genus.startsWith(abbrev)) { return genus + " " + parts[1]; } } return abbreviatedName; }  UsageExtensions interpret(NameUsage u, VerbatimNameUsage v); }
ExtensionInterpreter { @VisibleForTesting protected static String expandGenus(String abbreviatedName, String scientificName) { if (abbreviatedName != null && abbreviatedName.length() > 1 && scientificName != null && scientificName.length() > 2) { String[] parts = abbreviatedName.split("\\s+", 2); String genus = scientificName.split("\\s+", 2)[0]; String abbrev = parts[0].replaceAll("\\.$", ""); if (parts.length == 2 && abbrev.length() < 4 && genus.startsWith(abbrev)) { return genus + " " + parts[1]; } } return abbreviatedName; }  UsageExtensions interpret(NameUsage u, VerbatimNameUsage v);  }