@Test public void readThreeLine() throws IOException { BufferedReader someLines = new BufferedReader(new StringReader( "providedTaxonId,providedTaxonName,resolvedTaxonId,resolvedTaxonName\n" + "EOL:2888546,Toddalia asiatica,EOL:2888546,Toddalia asiatica\n" + "EOL:2888546,Toddalia asiatica,OTT:232693,Toddalia asiatica\n" + "EOL:1049789,Turtur tympanistria,EOL:1049789,Turtur tympanistria")); assertThat(someLines, is(notNullValue())); final List<String> taxa = new ArrayList<String>(); parse(someLines, new TaxonMapListener() { @Override public void addMapping(Taxon srcTaxon, Taxon targetTaxon) { taxa.add(srcTaxon.getExternalId() + srcTaxon.getName() + "-->" + targetTaxon.getExternalId() + targetTaxon.getName()); } @Override public void start() { } @Override public void finish() { } }); assertThat(taxa.size(), is(3)); assertThat(taxa.get(0), is("EOL:2888546Toddalia asiatica-->EOL:2888546Toddalia asiatica")); assertThat(taxa.get(1), is("EOL:2888546Toddalia asiatica-->OTT:232693Toddalia asiatica")); assertThat(taxa.get(2), is("EOL:1049789Turtur tympanistria-->EOL:1049789Turtur tympanistria")); }
public static Triple<Taxon, NameType, Taxon> parse(String line) { String[] strings = CSVTSVUtil.splitTSV(line); Taxon provided = parseProvidedTaxon(strings); Taxon resolved = parseResolvedTaxon(strings); if (ExternalIdUtil.isUnlikelyId(provided.getExternalId())) { provided = new TaxonImpl(provided.getName(), ""); } return new ImmutableTriple<>(provided, NameType.SAME_AS, resolved); }
TaxonMapParser { public static Triple<Taxon, NameType, Taxon> parse(String line) { String[] strings = CSVTSVUtil.splitTSV(line); Taxon provided = parseProvidedTaxon(strings); Taxon resolved = parseResolvedTaxon(strings); if (ExternalIdUtil.isUnlikelyId(provided.getExternalId())) { provided = new TaxonImpl(provided.getName(), ""); } return new ImmutableTriple<>(provided, NameType.SAME_AS, resolved); } }
TaxonMapParser { public static Triple<Taxon, NameType, Taxon> parse(String line) { String[] strings = CSVTSVUtil.splitTSV(line); Taxon provided = parseProvidedTaxon(strings); Taxon resolved = parseResolvedTaxon(strings); if (ExternalIdUtil.isUnlikelyId(provided.getExternalId())) { provided = new TaxonImpl(provided.getName(), ""); } return new ImmutableTriple<>(provided, NameType.SAME_AS, resolved); }  }
TaxonMapParser { public static Triple<Taxon, NameType, Taxon> parse(String line) { String[] strings = CSVTSVUtil.splitTSV(line); Taxon provided = parseProvidedTaxon(strings); Taxon resolved = parseResolvedTaxon(strings); if (ExternalIdUtil.isUnlikelyId(provided.getExternalId())) { provided = new TaxonImpl(provided.getName(), ""); } return new ImmutableTriple<>(provided, NameType.SAME_AS, resolved); }  static Taxon parseResolvedTaxon(String line[]); static Taxon parseProvidedTaxon(String line[]); static Triple<Taxon, NameType, Taxon> parse(String line); }
TaxonMapParser { public static Triple<Taxon, NameType, Taxon> parse(String line) { String[] strings = CSVTSVUtil.splitTSV(line); Taxon provided = parseProvidedTaxon(strings); Taxon resolved = parseResolvedTaxon(strings); if (ExternalIdUtil.isUnlikelyId(provided.getExternalId())) { provided = new TaxonImpl(provided.getName(), ""); } return new ImmutableTriple<>(provided, NameType.SAME_AS, resolved); }  static Taxon parseResolvedTaxon(String line[]); static Taxon parseProvidedTaxon(String line[]); static Triple<Taxon, NameType, Taxon> parse(String line);  }