@@ -1413,9 +1413,45 @@ void iterable_soft_assertions_should_report_errors_on_final_methods_and_methods_
14131413 .filteredOnAssertions (name -> assertThat (name .first ).startsWith ("Jo" ))
14141414 .as ("filteredOn with consumer" )
14151415 .hasSize (5 );
1416+ softly .assertThat (characters )
1417+ .as ("using flatMap on Iterable" )
1418+ .overridingErrorMessage ("error message" )
1419+ .flatMap (childrenExtractor )
1420+ .containsAnyOf (homer , fred );
1421+ softly .assertThat (characters )
1422+ .as ("using flatMap on Iterable with exception" )
1423+ .overridingErrorMessage ("error message" )
1424+ .flatMap (CartoonCharacter ::getChildrenWithException )
1425+ .containsExactlyInAnyOrder (homer , fred );
1426+ softly .assertThat (names )
1427+ .overridingErrorMessage ("error message" )
1428+ .as ("flatMap with multiple Extractors" )
1429+ .flatMap (firstNameFunction , lastNameFunction )
1430+ .contains ("John" , "Jane" , "Doe" )
1431+ .contains ("Sauron" );
1432+ softly .assertThat (names )
1433+ .overridingErrorMessage ("error message" )
1434+ .as ("flatMap with multiple ThrowingExtractors" )
1435+ .flatMap (throwingFirstNameFunction , throwingLastNameFunction )
1436+ .contains ("John" , "Jane" , "Doe" )
1437+ .contains ("Sauron" );
1438+ softly .assertThat (names )
1439+ .as ("map(throwingFirstNameFunction)" )
1440+ .overridingErrorMessage ("error message" )
1441+ .map (throwingFirstNameFunction )
1442+ .contains ("frodo" );
1443+ softly .assertThat (names )
1444+ .as ("map(firstNameFunction)" )
1445+ .map (firstNameFunction )
1446+ .contains ("sam" );
1447+ softly .assertThat (names )
1448+ .map (firstNameFunction , lastNameFunction )
1449+ .as ("map with multiple functions" )
1450+ .contains (tuple ("John" , "Doe" ))
1451+ .contains (tuple ("Frodo" , "Baggins" ));
14161452 // THEN
14171453 List <Throwable > errorsCollected = softly .errorsCollected ();
1418- assertThat (errorsCollected ).hasSize (33 );
1454+ assertThat (errorsCollected ).hasSize (40 );
14191455 assertThat (errorsCollected .get (0 )).hasMessage ("[extracting(throwingFirstNameFunction)] error message" );
14201456 assertThat (errorsCollected .get (1 )).hasMessage ("[extracting(throwingFirstNameFunction)] error message" );
14211457 assertThat (errorsCollected .get (2 )).hasMessage ("[extracting(\" last\" )] error message" );
@@ -1449,6 +1485,13 @@ void iterable_soft_assertions_should_report_errors_on_final_methods_and_methods_
14491485 assertThat (errorsCollected .get (30 )).hasMessage ("[using flatExtracting(String... fieldOrPropertyNames)] error message" );
14501486 assertThat (errorsCollected .get (31 )).hasMessage ("[using flatExtracting(String fieldOrPropertyName)] error message" );
14511487 assertThat (errorsCollected .get (32 )).hasMessage ("[filteredOn with consumer] error message" );
1488+ assertThat (errorsCollected .get (33 )).hasMessageContaining ("using flatMap on Iterable" );
1489+ assertThat (errorsCollected .get (34 )).hasMessageContaining ("using flatMap on Iterable with exception" );
1490+ assertThat (errorsCollected .get (35 )).hasMessageContaining ("flatMap with multiple Extractors" );
1491+ assertThat (errorsCollected .get (36 )).hasMessageContaining ("flatMap with multiple ThrowingExtractors" );
1492+ assertThat (errorsCollected .get (37 )).hasMessageContaining ("map(throwingFirstNameFunction)" );
1493+ assertThat (errorsCollected .get (38 )).hasMessageContaining ("map(firstNameFunction)" );
1494+ assertThat (errorsCollected .get (39 )).hasMessageContaining ("map with multiple functions" );
14521495 }
14531496
14541497 // the test would fail if any method was not proxyable as the assertion error would not be softly caught
@@ -1597,9 +1640,45 @@ void list_soft_assertions_should_report_errors_on_final_methods_and_methods_that
15971640 .filteredOnAssertions (name -> assertThat (name .first ).startsWith ("Jo" ))
15981641 .as ("filteredOn with consumer" )
15991642 .hasSize (5 );
1643+ softly .assertThat (names )
1644+ .overridingErrorMessage ("error message" )
1645+ .as ("flatMap with multiple Extractors" )
1646+ .flatMap (firstNameFunction , lastNameFunction )
1647+ .contains ("John" , "Jane" , "Doe" )
1648+ .contains ("Sauron" );
1649+ softly .assertThat (names )
1650+ .overridingErrorMessage ("error message" )
1651+ .as ("flatMap with multiple ThrowingExtractors" )
1652+ .flatMap (throwingFirstNameFunction , throwingLastNameFunction )
1653+ .contains ("John" , "Jane" , "Doe" )
1654+ .contains ("Sauron" );
1655+ softly .assertThat (characters )
1656+ .as ("using flatMap on Iterable" )
1657+ .overridingErrorMessage ("error message" )
1658+ .flatMap (childrenExtractor )
1659+ .containsAnyOf (homer , fred );
1660+ softly .assertThat (characters )
1661+ .as ("using flatMap on Iterable with exception" )
1662+ .overridingErrorMessage ("error message" )
1663+ .flatMap (CartoonCharacter ::getChildrenWithException )
1664+ .containsExactlyInAnyOrder (homer , fred );
1665+ softly .assertThat (names )
1666+ .as ("map(throwingFirstNameFunction)" )
1667+ .overridingErrorMessage ("error message" )
1668+ .map (throwingFirstNameFunction )
1669+ .contains ("frodo" );
1670+ softly .assertThat (names )
1671+ .as ("map(firstNameFunction)" )
1672+ .map (firstNameFunction )
1673+ .contains ("sam" );
1674+ softly .assertThat (names )
1675+ .map (firstNameFunction , lastNameFunction )
1676+ .as ("map with multiple functions" )
1677+ .contains (tuple ("John" , "Doe" ))
1678+ .contains (tuple ("Frodo" , "Baggins" ));
16001679 // THEN
16011680 List <Throwable > errorsCollected = softly .errorsCollected ();
1602- assertThat (errorsCollected ).hasSize (33 );
1681+ assertThat (errorsCollected ).hasSize (40 );
16031682 assertThat (errorsCollected .get (0 )).hasMessage ("[extracting(throwingFirstNameFunction)] error message" );
16041683 assertThat (errorsCollected .get (1 )).hasMessage ("[extracting(throwingFirstNameFunction)] error message" );
16051684 assertThat (errorsCollected .get (2 )).hasMessage ("[extracting(\" last\" )] error message" );
@@ -1633,6 +1712,13 @@ void list_soft_assertions_should_report_errors_on_final_methods_and_methods_that
16331712 assertThat (errorsCollected .get (30 )).hasMessage ("[using flatExtracting(String... fieldOrPropertyNames)] error message" );
16341713 assertThat (errorsCollected .get (31 )).hasMessage ("[using flatExtracting(String fieldOrPropertyName)] error message" );
16351714 assertThat (errorsCollected .get (32 )).hasMessage ("[filteredOn with consumer] error message" );
1715+ assertThat (errorsCollected .get (33 )).hasMessageContaining ("flatMap with multiple Extractors" );
1716+ assertThat (errorsCollected .get (34 )).hasMessageContaining ("flatMap with multiple ThrowingExtractors" );
1717+ assertThat (errorsCollected .get (35 )).hasMessageContaining ("using flatMap on Iterable" );
1718+ assertThat (errorsCollected .get (36 )).hasMessageContaining ("using flatMap on Iterable with exception" );
1719+ assertThat (errorsCollected .get (37 )).hasMessageContaining ("map(throwingFirstNameFunction)" );
1720+ assertThat (errorsCollected .get (38 )).hasMessageContaining ("map(firstNameFunction)" );
1721+ assertThat (errorsCollected .get (39 )).hasMessageContaining ("map with multiple functions" );
16361722 }
16371723
16381724 // the test would fail if any method was not proxyable as the assertion error would not be softly caught
0 commit comments