@@ -240,45 +240,25 @@ private static void testParser(final String msg, final CSVParserFactory fac) thr
240240 show ();
241241 }
242242
243+ @ FunctionalInterface
243244 private static interface CSVParserFactory {
244245 public CSVParser createParser () throws IOException ;
245246 }
246247
247248 private static void testParseCommonsCSV () throws Exception {
248- testParser ("CSV" , new CSVParserFactory () {
249- @ Override
250- public CSVParser createParser () throws IOException {
251- return new CSVParser (createReader (), format );
252- }
253- });
249+ testParser ("CSV" , () -> new CSVParser (createReader (), format ));
254250 }
255251
256252 private static void testParsePath () throws Exception {
257- testParser ("CSV-PATH" , new CSVParserFactory () {
258- @ Override
259- public CSVParser createParser () throws IOException {
260- return CSVParser .parse (Files .newInputStream (Paths .get (BIG_FILE .toURI ())), StandardCharsets .ISO_8859_1 , format );
261- }
262- });
253+ testParser ("CSV-PATH" , () -> CSVParser .parse (Files .newInputStream (Paths .get (BIG_FILE .toURI ())), StandardCharsets .ISO_8859_1 , format ));
263254 }
264255
265256 private static void testParsePathDoubleBuffering () throws Exception {
266- testParser ("CSV-PATH-DB" , new CSVParserFactory () {
267- @ Override
268- public CSVParser createParser () throws IOException {
269- return CSVParser .parse (Files .newBufferedReader (Paths .get (BIG_FILE .toURI ()), StandardCharsets .ISO_8859_1 ), format );
270- }
271- });
257+ testParser ("CSV-PATH-DB" , () -> CSVParser .parse (Files .newBufferedReader (Paths .get (BIG_FILE .toURI ()), StandardCharsets .ISO_8859_1 ), format ));
272258 }
273259
274260 private static void testParseURL () throws Exception {
275- testParser ("CSV-URL" , new CSVParserFactory () {
276- @ Override
277- public CSVParser createParser () throws IOException {
278- //NOTE: URL will always return a BufferedInputStream.
279- return CSVParser .parse (BIG_FILE .toURI ().toURL (), StandardCharsets .ISO_8859_1 , format );
280- }
281- });
261+ testParser ("CSV-URL" , () -> CSVParser .parse (BIG_FILE .toURI ().toURL (), StandardCharsets .ISO_8859_1 , format ));
282262 }
283263
284264 private static Constructor <Lexer > getLexerCtor (final String clazz ) throws Exception {
0 commit comments