@Test void ignoreLineWithoutValidAccessionPrefix() { when(tsvStreamerMock.get()) .thenReturn(Stream.<String[]>of(new String[] {"foo:0000001", "bar"})); Map<String, OntologyTerm> map = InterProTsvParser.parse(tsvStreamerMock); assertThat(map).isEmpty(); }
public static ImmutableMap<String, OntologyTerm> parse(TsvStreamer tsvStreamer) { return tsvStreamer.get() .filter(line -> line.length > 2) .filter(line -> line[ACCESSION_COLUMN_INDEX].startsWith("IPR")) .collect(toImmutableMap( line -> line[ACCESSION_COLUMN_INDEX], line -> OntologyTerm.create( line[ACCESSION_COLUMN_INDEX], line[NAME_COLUMN_INDEX] + " (" + line[TYPE_COLUMN_INDEX].toLowerCase() + ")"))); }
InterProTsvParser { public static ImmutableMap<String, OntologyTerm> parse(TsvStreamer tsvStreamer) { return tsvStreamer.get() .filter(line -> line.length > 2) .filter(line -> line[ACCESSION_COLUMN_INDEX].startsWith("IPR")) .collect(toImmutableMap( line -> line[ACCESSION_COLUMN_INDEX], line -> OntologyTerm.create( line[ACCESSION_COLUMN_INDEX], line[NAME_COLUMN_INDEX] + " (" + line[TYPE_COLUMN_INDEX].toLowerCase() + ")"))); } }
InterProTsvParser { public static ImmutableMap<String, OntologyTerm> parse(TsvStreamer tsvStreamer) { return tsvStreamer.get() .filter(line -> line.length > 2) .filter(line -> line[ACCESSION_COLUMN_INDEX].startsWith("IPR")) .collect(toImmutableMap( line -> line[ACCESSION_COLUMN_INDEX], line -> OntologyTerm.create( line[ACCESSION_COLUMN_INDEX], line[NAME_COLUMN_INDEX] + " (" + line[TYPE_COLUMN_INDEX].toLowerCase() + ")"))); } protected  InterProTsvParser(); }
InterProTsvParser { public static ImmutableMap<String, OntologyTerm> parse(TsvStreamer tsvStreamer) { return tsvStreamer.get() .filter(line -> line.length > 2) .filter(line -> line[ACCESSION_COLUMN_INDEX].startsWith("IPR")) .collect(toImmutableMap( line -> line[ACCESSION_COLUMN_INDEX], line -> OntologyTerm.create( line[ACCESSION_COLUMN_INDEX], line[NAME_COLUMN_INDEX] + " (" + line[TYPE_COLUMN_INDEX].toLowerCase() + ")"))); } protected  InterProTsvParser(); static ImmutableMap<String, OntologyTerm> parse(TsvStreamer tsvStreamer); }
InterProTsvParser { public static ImmutableMap<String, OntologyTerm> parse(TsvStreamer tsvStreamer) { return tsvStreamer.get() .filter(line -> line.length > 2) .filter(line -> line[ACCESSION_COLUMN_INDEX].startsWith("IPR")) .collect(toImmutableMap( line -> line[ACCESSION_COLUMN_INDEX], line -> OntologyTerm.create( line[ACCESSION_COLUMN_INDEX], line[NAME_COLUMN_INDEX] + " (" + line[TYPE_COLUMN_INDEX].toLowerCase() + ")"))); } protected  InterProTsvParser(); static ImmutableMap<String, OntologyTerm> parse(TsvStreamer tsvStreamer);  }