@@ -1244,14 +1244,6 @@ public AbstractListAssert<?, List<? extends Tuple>, Tuple, ObjectAssert<Tuple>>
1244
1244
* fellowshipOfTheRing.add(new TolkienCharacter("Aragorn", 87, MAN);
1245
1245
* fellowshipOfTheRing.add(new TolkienCharacter("Boromir", 37, MAN));
1246
1246
*
1247
- * // this extracts the race
1248
- * Function<TolkienCharacter, Race> race = new Function<TolkienCharacter, Race>() {
1249
- * {@literal @}Override
1250
- * public Race apply(TolkienCharacter input) {
1251
- * return input.getRace();
1252
- * }
1253
- * }
1254
- *
1255
1247
* // fellowship has hobbitses, right, my presioussss?
1256
1248
* assertThat(fellowshipOfTheRing).extracting(TolkienCharacter::getRace).contains(HOBBIT);</code></pre>
1257
1249
*
@@ -1341,23 +1333,19 @@ private <V> AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>> newList
1341
1333
* CartoonCharacter lisa = new CartoonCharacter("Lisa Simpson");
1342
1334
* CartoonCharacter maggie = new CartoonCharacter("Maggie Simpson");
1343
1335
* CartoonCharacter homer = new CartoonCharacter("Homer Simpson");
1344
- * homer.addChildren(bart, lisa, maggie);
1336
+ * homer.getChildren().add(bart);
1337
+ * homer.getChildren().add(lisa);
1338
+ * homer.getChildren().add(maggie);
1345
1339
*
1346
1340
* CartoonCharacter pebbles = new CartoonCharacter("Pebbles Flintstone");
1347
1341
* CartoonCharacter fred = new CartoonCharacter("Fred Flintstone");
1348
1342
* fred.getChildren().add(pebbles);
1349
1343
*
1350
- * Function<CartoonCharacter, List<CartoonCharacter>> childrenOf = new Function<CartoonChildren, List<CartoonChildren>>() {
1351
- * {@literal @}Override
1352
- * public List<CartoonChildren> extract(CartoonCharacter input) {
1353
- * return input.getChildren();
1354
- * }
1355
- * }
1344
+ * List<CartoonCharacter> parents = list(homer, fred);
1356
1345
*
1357
- * List<CartoonCharacter> parents = newArrayList(homer, fred);
1358
- * // check children
1359
- * assertThat(parent).flatExtracting(CartoonCharacter::getChildren)
1360
- * .containsOnly(bart, lisa, maggie, pebbles);</code></pre>
1346
+ * // check children property which is a List<CartoonCharacter>
1347
+ * assertThat(parents).flatExtracting(CartoonCharacter::getChildren)
1348
+ * .containsOnly(bart, lisa, maggie, pebbles);</code></pre>
1361
1349
*
1362
1350
* The order of extracted values is consistent with both the order of the collection itself, as well as the extracted
1363
1351
* collections.
@@ -1374,7 +1362,7 @@ public <V> AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>> flatExtr
1374
1362
1375
1363
/**
1376
1364
* Extract the Iterable values from Iterable's elements under test by applying an Iterable extracting function (which
1377
- * might throw an exception) on them and concatenating the result lists. The returned iterable becomes a new object
1365
+ * might throw a checked exception) on them and concatenating the result lists. The returned iterable becomes a new object
1378
1366
* under test.
1379
1367
* <p>
1380
1368
* It allows testing the results of extracting values that are represented by Iterables.
@@ -1384,20 +1372,19 @@ public <V> AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>> flatExtr
1384
1372
* CartoonCharacter lisa = new CartoonCharacter("Lisa Simpson");
1385
1373
* CartoonCharacter maggie = new CartoonCharacter("Maggie Simpson");
1386
1374
* CartoonCharacter homer = new CartoonCharacter("Homer Simpson");
1387
- * homer.addChildren(bart, lisa, maggie);
1375
+ * homer.getChildren().add(bart);
1376
+ * homer.getChildren().add(lisa);
1377
+ * homer.getChildren().add(maggie);
1388
1378
*
1389
1379
* CartoonCharacter pebbles = new CartoonCharacter("Pebbles Flintstone");
1390
1380
* CartoonCharacter fred = new CartoonCharacter("Fred Flintstone");
1391
1381
* fred.getChildren().add(pebbles);
1392
1382
*
1393
- * List<CartoonCharacter> parents = newArrayList(homer, fred);
1394
- * // check children
1395
- * assertThat(parent).flatExtracting((ThrowingExtractor<CartoonCharacter, List<CartoonCharacter>, Exception>)input -> {
1396
- * if (input.getChildren().size() == 0) {
1397
- * throw new Exception("no children");
1398
- * }
1399
- * return input.getChildren();
1400
- * }).containsOnly(bart, lisa, maggie, pebbles);</code></pre>
1383
+ * List<CartoonCharacter> parents = list(homer, fred);
1384
+ *
1385
+ * // check children property where getChildren() can throw an Exception!
1386
+ * assertThat(parents).flatExtracting(CartoonCharacter::getChildren)
1387
+ * .containsOnly(bart, lisa, maggie, pebbles);</code></pre>
1401
1388
*
1402
1389
* The order of extracted values is consistent with both the order of the collection itself, as well as the extracted
1403
1390
* collections.
@@ -1510,14 +1497,17 @@ public <EXCEPTION extends Exception> AbstractListAssert<?, List<? extends Object
1510
1497
* CartoonCharacter lisa = new CartoonCharacter("Lisa Simpson");
1511
1498
* CartoonCharacter maggie = new CartoonCharacter("Maggie Simpson");
1512
1499
* CartoonCharacter homer = new CartoonCharacter("Homer Simpson");
1513
- * homer.addChildren(bart, lisa, maggie);
1500
+ * homer.getChildren().add(bart);
1501
+ * homer.getChildren().add(lisa);
1502
+ * homer.getChildren().add(maggie);
1514
1503
*
1515
1504
* CartoonCharacter pebbles = new CartoonCharacter("Pebbles Flintstone");
1516
1505
* CartoonCharacter fred = new CartoonCharacter("Fred Flintstone");
1517
1506
* fred.getChildren().add(pebbles);
1518
1507
*
1519
- * List<CartoonCharacter> parents = newArrayList(homer, fred);
1520
- * // check children
1508
+ * List<CartoonCharacter> parents = list(homer, fred);
1509
+ *
1510
+ * // check children which is a List<CartoonCharacter>
1521
1511
* assertThat(parents).flatExtracting("children")
1522
1512
* .containsOnly(bart, lisa, maggie, pebbles);</code></pre>
1523
1513
*
@@ -1580,7 +1570,7 @@ public AbstractListAssert<?, List<? extends Object>, Object, ObjectAssert<Object
1580
1570
*
1581
1571
* // let's verify 'name', 'age' and Race of some TolkienCharacter in fellowshipOfTheRing :
1582
1572
* assertThat(fellowshipOfTheRing).extracting(TolkienCharacter::getName,
1583
- * character > character.getAge(),
1573
+ * character - > character.getAge(),
1584
1574
* TolkienCharacter::getRace)
1585
1575
* .containsOnly(tuple("Frodo", 33, HOBBIT),
1586
1576
* tuple("Sam", 38, HOBBIT),
0 commit comments