@@ -584,19 +584,19 @@ void testEndOfFileBehaviorExcel() throws Exception {
584584 }
585585 }
586586
587- @ Test
588- void testEscapedNullStringIsAValue () throws Exception {
587+ @ ParameterizedTest
588+ @ EnumSource (value = CSVFormat .Predefined .class , names = { "MySQL" , "PostgreSQLCsv" , "PostgreSQLText" , "Oracle" })
589+ void testEscapedNullStringIsAValue (final CSVFormat .Predefined predefined ) throws Exception {
589590 // "\N" is the MySQL and PostgreSQL null marker, "\\N" is the value "\N", which is what the printer writes for it.
590- for (final CSVFormat format : new CSVFormat [] { CSVFormat .MYSQL , CSVFormat .POSTGRESQL_TEXT , CSVFormat .ORACLE }) {
591- final StringWriter writer = new StringWriter ();
592- try (CSVPrinter printer = new CSVPrinter (writer , format )) {
593- printer .printRecord ("\\ N" , null );
594- }
595- try (CSVParser parser = CSVParser .parse (writer .toString (), format )) {
596- final CSVRecord record = parser .nextRecord ();
597- assertEquals ("\\ N" , record .get (0 ), format .toString ());
598- assertNull (record .get (1 ), format .toString ());
599- }
591+ final CSVFormat format = predefined .getFormat ();
592+ final StringWriter writer = new StringWriter ();
593+ try (CSVPrinter printer = new CSVPrinter (writer , format )) {
594+ printer .printRecord ("\\ N" , null );
595+ }
596+ try (CSVParser parser = CSVParser .parse (writer .toString (), format )) {
597+ final CSVRecord record = parser .nextRecord ();
598+ assertEquals ("\\ N" , record .get (0 ));
599+ assertNull (record .get (1 ));
600600 }
601601 }
602602
0 commit comments