Skip to content

Commit e75b90a

Browse files
committed
Use try-with-resources
1 parent ae79aea commit e75b90a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/test/java/org/apache/commons/csv/CSVRecordTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ record = parser.iterator().next();
8484

8585
@Test
8686
public void testCSVRecordNULLValues() throws IOException {
87-
final CSVParser parser = CSVParser.parse("A,B\r\nONE,TWO", CSVFormat.DEFAULT.withHeader());
88-
final CSVRecord csvRecord = new CSVRecord(parser, null, null, 0L, 0L);
89-
assertEquals(0, csvRecord.size());
90-
assertThrows(IllegalArgumentException.class, () -> csvRecord.get("B"));
87+
try (CSVParser parser = CSVParser.parse("A,B\r\nONE,TWO", CSVFormat.DEFAULT.withHeader())) {
88+
final CSVRecord csvRecord = new CSVRecord(parser, null, null, 0L, 0L);
89+
assertEquals(0, csvRecord.size());
90+
assertThrows(IllegalArgumentException.class, () -> csvRecord.get("B"));
91+
}
9192
}
9293

9394
@Test

0 commit comments

Comments
 (0)