@@ -36,7 +36,8 @@ class ThrowableUtilsTest {
3636 private static final Set <String > FALSE_POSITIVES = Set .of ( //
3737 "junit.framework.AssertionFailedError" , // deviation for null message is not an issue
3838 "java.util.IllformedLocaleException" , // we don't need the index attribute itself
39- "java.awt.HeadlessException" // CI systems don't like this, but the constructor works
39+ "java.awt.HeadlessException" , // CI systems don't like this, but the constructor works
40+ "org.assertj.core.util.introspection.IntrospectionError" // this is a wrapper for a Throwable, so it is not an issue
4041 );
4142
4243 private static final Set <Class <?>> SAFE_PROPERTY_TYPES = Set .of (Throwable .class , Throwable [].class );
@@ -56,7 +57,7 @@ void testConstructorInstantiation() {
5657 return !validate (type , preferredConstructor );
5758 }).sorted (Comparator .comparing (Object ::toString )).collect (Collectors .toList ());
5859 assertThat (duplicationFailures )
59- .as ("the default Throwable duplication works for all SAFE_TYPE classes that are not specially handeled " )
60+ .as ("the default Throwable duplication works for all SAFE_TYPE classes that are not specially handled " )
6061 .isEmpty ();
6162 }
6263
@@ -89,18 +90,16 @@ void checkProperties() {
8990 .map (Method ::getReturnType ).distinct ().filter (type -> {
9091 Class <?> containedType ;
9192 if (type .isArray ())
92- containedType = Stream .<Class <?>>iterate (type , Class ::getComponentType )
93- .takeWhile (Objects ::nonNull ).reduce (null , (a , b ) -> b );
93+ containedType = Stream .<Class <?>>iterate (type , Objects ::nonNull , Class ::getComponentType ).reduce (null , (a , b ) -> b );
9494 else
9595 containedType = type ;
96- if (containedType .isPrimitive ())
96+ assertThat (containedType ).isNotNull ();
97+ if (containedType .isPrimitive ())
9798 return false ;
9899 if (Modifier .isFinal (containedType .getModifiers ()))
99100 return false ;
100- if (SAFE_PROPERTY_TYPES .stream ().anyMatch (safeType -> safeType .isAssignableFrom (containedType )))
101- return false ;
102- return true ;
103- }).collect (Collectors .toSet ());
101+ return SAFE_PROPERTY_TYPES .stream ().noneMatch (safeType -> safeType .isAssignableFrom (containedType ));
102+ }).collect (Collectors .toSet ());
104103 assertThat (potentiallyUnsafeProperties ).as ("property types are all safe or sanitizable" ).isEmpty ();
105104 }
106105
0 commit comments