mirror of
https://github.com/apache/commons-csv.git
synced 2025-02-17 07:26:32 +00:00
Better resource management.
This commit is contained in:
parent
e06b8451f2
commit
b3daff2323
@ -67,14 +67,16 @@ public class JiraCsv247Test {
|
||||
assertFalse(format.getAllowMissingColumnNames(), "By default we should not allow missing column names");
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
try (final Reader in = new StringReader("a,,c,d,e\n1,2,3,4,5\nv,w,x,y,z")) {
|
||||
format.parse(in);
|
||||
try (final Reader reader = new StringReader("a,,c,d,e\n1,2,3,4,5\nv,w,x,y,z");
|
||||
CSVParser parser = format.parse(reader);) {
|
||||
// should fail
|
||||
}
|
||||
}, "1 missing column header is not allowed");
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
try (final Reader in = new StringReader("a,,c,d,\n1,2,3,4,5\nv,w,x,y,z")) {
|
||||
format.parse(in);
|
||||
try (final Reader reader = new StringReader("a,,c,d,\n1,2,3,4,5\nv,w,x,y,z");
|
||||
CSVParser parser = format.parse(reader);) {
|
||||
// should fail
|
||||
}
|
||||
}, "2+ missing column headers is not allowed!");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user