File tree Expand file tree Collapse file tree
fontbox/src/test/java/org/apache/fontbox/type1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 */
1919package org .apache .fontbox .type1 ;
2020
21+ import static org .junit .jupiter .api .Assertions .assertEquals ;
22+ import static org .junit .jupiter .api .Assertions .assertThrows ;
23+
2124import java .io .IOException ;
2225import java .nio .charset .StandardCharsets ;
2326import 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
You can’t perform that action at this time.
0 commit comments