Example #1
0
  @Test
  public void shouldReadFromMultipleReaders() throws Exception {
    // GIVEN
    String[][] data =
        new String[][] {
          {"this is", "the first line"},
          {"where this", "is the second line"},
          {"and here comes", "the third line"}
        };
    RawIterator<Reader, IOException> readers = readerIteratorFromStrings(data, null);
    CharSeeker seeker = CharSeekers.charSeeker(new MultiReadable(readers), 200, true, '"');

    // WHEN/THEN
    for (String[] line : data) {
      assertNextLine(line, seeker, mark, extractors);
    }
    assertFalse(seeker.seek(mark, delimiter));
    seeker.close();
  }
Example #2
0
  @Test
  public void shouldHandleSourcesEndingWithNewLine() throws Exception {
    // GIVEN
    String[][] data =
        new String[][] {
          {"this is", "the first line"},
          {"where this", "is the second line"},
        };

    // WHEN
    RawIterator<Reader, IOException> readers = readerIteratorFromStrings(data, '\n');
    CharSeeker seeker = CharSeekers.charSeeker(Readables.sources(readers), 200, true, '"');

    // WHEN/THEN
    for (String[] line : data) {
      assertNextLine(line, seeker, mark, extractors);
    }
    assertFalse(seeker.seek(mark, delimiter));
    seeker.close();
  }