Use try-with-resources

This commit is contained in:
Gary Gregory 2024-09-14 09:44:01 -04:00
parent de158f9817
commit 33129ba467
1 changed files with 4 additions and 3 deletions

View File

@ -452,8 +452,9 @@ public class LexerTest {
@Test
public void testTrimTrailingSpacesZeroLength() throws Exception {
final StringBuilder buffer = new StringBuilder("");
final Lexer lexer = createLexer(buffer.toString(), CSVFormat.DEFAULT);
try (Lexer lexer = createLexer(buffer.toString(), CSVFormat.DEFAULT)) {
lexer.trimTrailingSpaces(buffer);
assertThat(lexer.nextToken(new Token()), matches(EOF, ""));
}
}
}