@@ -41,8 +41,7 @@ void createDocumentAllFonts() {
4141 /* step 4:*/
4242 // the 14 standard fonts in PDF: do not use this Font constructor!
4343 // this is for demonstration purposes only, use FontFactory!
44- final List <StandardFonts > standardFonts = Arrays .stream (values ())
45- .filter (f -> !f .isDeprecated ()).collect (Collectors .toList ());
44+ final List <StandardFonts > standardFonts = List .of (values ());
4645 for (StandardFonts standardFont : standardFonts ) {
4746 // add the content
4847 Font font = standardFont .create ();
@@ -57,8 +56,7 @@ void createDocumentAllFonts() {
5756 @ Test
5857 void testNonDeprecatedFonts () {
5958 // given
60- final List <StandardFonts > standardFonts = Arrays .stream (values ())
61- .filter (f -> !f .isDeprecated ()).collect (Collectors .toList ());
59+ final List <StandardFonts > standardFonts = List .of (values ());
6260 // then
6361 assertThat (standardFonts ).containsExactlyInAnyOrder (
6462 COURIER , COURIER_BOLD , COURIER_BOLDITALIC , COURIER_ITALIC ,
@@ -72,29 +70,12 @@ void testNonDeprecatedFonts() {
7270 @ Test
7371 void testCreateStandardFonts () throws IOException {
7472 // given
75- final List <StandardFonts > standardFonts = Arrays .stream (values ())
76- .filter (f -> !f .isDeprecated ()).collect (Collectors .toList ());
73+ final List <StandardFonts > standardFonts = List .of (values ());
7774 for (StandardFonts standardFont : standardFonts ) {
7875 // when
7976 final Font font = standardFont .create ();
8077 // then
8178 assertNotNull (font );
8279 }
8380 }
84-
85- @ Test
86- void testCreateStandardDeprecatedFonts () {
87- // given
88- SoftAssertions softly = new SoftAssertions ();
89- final List <StandardFonts > deprecatedFonts = Arrays .stream (values ())
90- .filter (StandardFonts ::isDeprecated ).collect (Collectors .toList ());
91- // when
92- for (StandardFonts deprecatedFont : deprecatedFonts ) {
93- // then
94- softly .assertThatThrownBy (deprecatedFont ::create )
95- .isInstanceOf (IOException .class )
96- .hasMessageContaining (deprecatedFont .name ());
97- }
98- softly .assertAll ();
99- }
10081}
0 commit comments