CsvReader { public CsvParser parse(final Path path, final Charset charset) throws IOException { return parse(newPathReader( Objects.requireNonNull(path, "path must not be null"), Objects.requireNonNull(charset, "charset must not be null") )); }  void setFieldSeparator(final char fieldSeparator); void setTextDelimiter(final char textDelimiter); void setContainsHeader(final boolean containsHeader); void setSkipEmptyRows(final boolean skipEmptyRows); void setErrorOnDifferentFieldCount(final boolean errorOnDifferentFieldCount); CsvContainer read(final File file, final Charset charset); CsvContainer read(final Path path, final Charset charset); CsvContainer read(final Reader reader); CsvParser parse(final Path path, final Charset charset); CsvParser parse(final File file, final Charset charset); CsvParser parse(final Reader reader);  }
@Test(expectedExceptions = NullPointerException.class) public void nullInput() throws IOException { parse(findBugsSafeNullInput()); }
@Test(expectedExceptions = IndexOutOfBoundsException.class) public void getNonExistingFieldByIndex() throws IOException { final String findbugsSafeReturn = parse("foo").nextRow().getField(1); fail("must not return: " + findbugsSafeReturn); }
@Test(expectedExceptions = IllegalStateException.class) public void getFieldByNameWithoutHeader() throws IOException { parse("foo\n").nextRow().getField("bar"); }
@Test(expectedExceptions = IllegalStateException.class) public void getNonExistingHeader() throws IOException { final CsvParser csv = parse("foo\n"); csv.nextRow(); csv.getHeader(); }
@Test(expectedExceptions = IllegalStateException.class) public void getNonExistingFieldMap() throws IOException { final CsvParser csv = parse("foo\n"); final CsvRow csvRow = csv.nextRow(); csvRow.getFieldMap(); }