Skip to content

Commit f0831c2

Browse files
committed
PDFBOX-5660: Sonar fix
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1935329 13f79535-47bb-0310-9956-ffa450edef68
1 parent 6cc871f commit f0831c2

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*/
1919
package org.apache.fontbox.type1;
2020

21+
import static org.junit.jupiter.api.Assertions.assertEquals;
22+
import static org.junit.jupiter.api.Assertions.assertThrows;
23+
2124
import java.io.IOException;
2225
import java.nio.charset.StandardCharsets;
2326
import java.util.ArrayList;
@@ -72,20 +75,16 @@ void testEmptyName() throws IOException
7275
{
7376
String s = "dup 127 / put";
7477
Type1Lexer t1l = new Type1Lexer(s.getBytes(StandardCharsets.US_ASCII));
75-
Token nextToken;
76-
try
78+
DamagedFontException ex = assertThrows(DamagedFontException.class, () ->
7779
{
80+
Token nextToken;
7881
do
7982
{
8083
nextToken = t1l.nextToken();
8184
}
8285
while (nextToken != null);
83-
Assertions.fail("DamagedFontException expected");
84-
}
85-
catch (DamagedFontException ex)
86-
{
87-
Assertions.assertEquals("Could not read token at position 9", ex.getMessage());
88-
}
86+
});
87+
assertEquals("Could not read token at position 9", ex.getMessage());
8988
}
9089

9190
@Test

0 commit comments

Comments
 (0)