### Question:
FileIterator implements RelationalInput { @Override public List<String> next() throws InputIterationException { List<String> currentLine = this.nextLine; if (currentLine == null) { return null; } this.nextLine = readNextLine(); if (this.skipDifferingLines) { readToNextValidLine(); } else { failDifferingLine(currentLine); } return currentLine; } FileIterator(String relationName, Reader reader, ConfigurationSettingFileInput setting); @Override boolean hasNext(); @Override List<String> next(); @Override void close(); @Override int numberOfColumns(); @Override String relationName(); @Override List<String> columnNames(); int getNumberOfSkippedDifferingLines(); static final boolean DEFAULT_HAS_HEADER; static final boolean DEFAULT_SKIP_DIFFERING_LINES; static final String DEFAULT_NULL_VALUE; }### Answer:
@Test public void testNext() throws InputIterationException { assertEquals(this.fixture.getExpectedStrings(), this.fileIterator.next()); }
@Test public void testShortWithHeader() throws InputIterationException { CsvFileShortLineWithHeaderFixture shortLineFixture = new CsvFileShortLineWithHeaderFixture(); FileIterator csvFileShortWithHeader = shortLineFixture.getTestData(); try { csvFileShortWithHeader.next(); fail("Expected an InputIterationException to be thrown."); } catch (InputIterationException e) { assertTrue(e.getMessage().contains("2")); } }
@Test public void testParsingOfEmptyStrings() throws InputIterationException, InputGenerationException { CsvFileNullValuesFixture nullValuesFixture = new CsvFileNullValuesFixture(); FileIterator csvFile = nullValuesFixture.getTestData(); assertEquals(nullValuesFixture.getFirstLineWithNullValues(), csvFile.next()); assertEquals(nullValuesFixture.getSecondLineWithNullValues(), csvFile.next()); }
@Test public void testShort() throws InputIterationException, InputGenerationException { FileIterator shortCsvFile = new CsvFileShortLineFixture().getTestData(); try { shortCsvFile.next(); shortCsvFile.next(); fail("Expected an InputIterationException to be thrown."); } catch (InputIterationException e) { assertTrue(e.getMessage().contains("2")); } }