Skip to content

Commit e7c6465

Browse files
Javadoc improvements
1 parent 1841a12 commit e7c6465

File tree

6 files changed

+32
-38
lines changed

6 files changed

+32
-38
lines changed

src/main/java/org/assertj/core/api/AbstractIterableAssert.java

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,14 +1244,6 @@ public AbstractListAssert<?, List<? extends Tuple>, Tuple, ObjectAssert<Tuple>>
12441244
* fellowshipOfTheRing.add(new TolkienCharacter(&quot;Aragorn&quot;, 87, MAN);
12451245
* fellowshipOfTheRing.add(new TolkienCharacter(&quot;Boromir&quot;, 37, MAN));
12461246
*
1247-
* // this extracts the race
1248-
* Function&lt;TolkienCharacter, Race&gt; race = new Function&lt;TolkienCharacter, Race&gt;() {
1249-
* {@literal @}Override
1250-
* public Race apply(TolkienCharacter input) {
1251-
* return input.getRace();
1252-
* }
1253-
* }
1254-
*
12551247
* // fellowship has hobbitses, right, my presioussss?
12561248
* assertThat(fellowshipOfTheRing).extracting(TolkienCharacter::getRace).contains(HOBBIT);</code></pre>
12571249
*
@@ -1341,23 +1333,19 @@ private <V> AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>> newList
13411333
* CartoonCharacter lisa = new CartoonCharacter("Lisa Simpson");
13421334
* CartoonCharacter maggie = new CartoonCharacter("Maggie Simpson");
13431335
* 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);
13451339
*
13461340
* CartoonCharacter pebbles = new CartoonCharacter("Pebbles Flintstone");
13471341
* CartoonCharacter fred = new CartoonCharacter("Fred Flintstone");
13481342
* fred.getChildren().add(pebbles);
13491343
*
1350-
* Function&lt;CartoonCharacter, List&lt;CartoonCharacter&gt;&gt; childrenOf = new Function&lt;CartoonChildren, List&lt;CartoonChildren&gt;&gt;() {
1351-
* {@literal @}Override
1352-
* public List&lt;CartoonChildren&gt; extract(CartoonCharacter input) {
1353-
* return input.getChildren();
1354-
* }
1355-
* }
1344+
* List&lt;CartoonCharacter&gt; parents = list(homer, fred);
13561345
*
1357-
* List&lt;CartoonCharacter&gt; 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&lt;CartoonCharacter&gt;
1347+
* assertThat(parents).flatExtracting(CartoonCharacter::getChildren)
1348+
* .containsOnly(bart, lisa, maggie, pebbles);</code></pre>
13611349
*
13621350
* The order of extracted values is consistent with both the order of the collection itself, as well as the extracted
13631351
* collections.
@@ -1374,7 +1362,7 @@ public <V> AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>> flatExtr
13741362

13751363
/**
13761364
* 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
13781366
* under test.
13791367
* <p>
13801368
* 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
13841372
* CartoonCharacter lisa = new CartoonCharacter("Lisa Simpson");
13851373
* CartoonCharacter maggie = new CartoonCharacter("Maggie Simpson");
13861374
* 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);
13881378
*
13891379
* CartoonCharacter pebbles = new CartoonCharacter("Pebbles Flintstone");
13901380
* CartoonCharacter fred = new CartoonCharacter("Fred Flintstone");
13911381
* fred.getChildren().add(pebbles);
13921382
*
1393-
* List&lt;CartoonCharacter&gt; parents = newArrayList(homer, fred);
1394-
* // check children
1395-
* assertThat(parent).flatExtracting((ThrowingExtractor&lt;CartoonCharacter, List&lt;CartoonCharacter&gt;, Exception&gt;)input -&gt; {
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&lt;CartoonCharacter&gt; 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>
14011388
*
14021389
* The order of extracted values is consistent with both the order of the collection itself, as well as the extracted
14031390
* collections.
@@ -1510,14 +1497,17 @@ public <EXCEPTION extends Exception> AbstractListAssert<?, List<? extends Object
15101497
* CartoonCharacter lisa = new CartoonCharacter("Lisa Simpson");
15111498
* CartoonCharacter maggie = new CartoonCharacter("Maggie Simpson");
15121499
* 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);
15141503
*
15151504
* CartoonCharacter pebbles = new CartoonCharacter("Pebbles Flintstone");
15161505
* CartoonCharacter fred = new CartoonCharacter("Fred Flintstone");
15171506
* fred.getChildren().add(pebbles);
15181507
*
1519-
* List&lt;CartoonCharacter&gt; parents = newArrayList(homer, fred);
1520-
* // check children
1508+
* List&lt;CartoonCharacter&gt; parents = list(homer, fred);
1509+
*
1510+
* // check children which is a List&lt;CartoonCharacter&gt;
15211511
* assertThat(parents).flatExtracting("children")
15221512
* .containsOnly(bart, lisa, maggie, pebbles);</code></pre>
15231513
*
@@ -1580,7 +1570,7 @@ public AbstractListAssert<?, List<? extends Object>, Object, ObjectAssert<Object
15801570
*
15811571
* // let's verify 'name', 'age' and Race of some TolkienCharacter in fellowshipOfTheRing :
15821572
* assertThat(fellowshipOfTheRing).extracting(TolkienCharacter::getName,
1583-
* character &gt; character.getAge(),
1573+
* character -&gt; character.getAge(),
15841574
* TolkienCharacter::getRace)
15851575
* .containsOnly(tuple(&quot;Frodo&quot;, 33, HOBBIT),
15861576
* tuple(&quot;Sam&quot;, 38, HOBBIT),

src/main/java/org/assertj/core/api/AbstractLocalDateTimeAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,12 @@ public SELF isNotIn(String... dateTimesAsString) {
332332
* Example:
333333
* <pre><code class='java'> LocalDateTime actual = LocalDateTime.now(Clock.systemUTC());
334334
*
335-
* // assertion will pass as it is executed less than one second after actual was built
335+
* // assertion will pass as if executed less than one second after actual was built
336336
* assertThat(actual).isCloseToUtcNow(within(1, ChronoUnit.SECONDS));
337337
*
338338
* // assertion will fail
339339
* assertThat(actual.plusSeconds(2)).isCloseToUtcNow(within(1, ChronoUnit.SECONDS));</code></pre>
340-
*
340+
*
341341
* @param offset The offset used for comparison
342342
* @return this assertion object
343343
* @throws NullPointerException if {@code offset} parameter is {@code null}.

src/main/java/org/assertj/core/api/AbstractMapAssert.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,10 @@ public SELF containsExactlyEntriesOf(Map<? extends K, ? extends V> map) {
639639
* assertThat(ringBearers).containsExactlyInAnyOrderEntriesOf(newLinkedHashMap(entry(nenya, galadriel),
640640
* entry(narya, gandalf),
641641
* entry(oneRing, frodo)));
642+
* // assertion will fail as actual does not contain all expected entries
643+
* assertThat(ringBearers).containsExactlyInAnyOrderEntriesOf(newLinkedHashMap(entry(oneRing, frodo),
644+
* entry(nenya, galadriel),
645+
* entry(vilya, elrond)));
642646
* // assertion will fail as actual and expected have different sizes
643647
* assertThat(ringBearers).containsExactlyInAnyOrderEntriesOf(newLinkedHashMap(entry(oneRing, frodo),
644648
* entry(nenya, galadriel),

src/main/java/org/assertj/core/api/AbstractObjectAssert.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ public AbstractListAssert<?, List<?>, Object, ObjectAssert<Object>> extracting(@
712712
* assertThat(frodo).extracting(TolkienCharacter::getName)
713713
* .startsWith(&quot;Fro&quot;);</code></pre>
714714
*
715+
* @param <T> the expected extracted value type.
715716
* @param extractor the extractor function used to extract the value from the object under test.
716717
* @return a new {@link ObjectAssert} instance whose object under test is the extracted value
717718
*

src/main/java/org/assertj/core/api/AbstractOffsetDateTimeAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ public SELF isAfter(String offsetDateTimeAsString) {
253253
* Example:
254254
* <pre><code class='java'> OffsetDateTime actual = OffsetDateTime.now(Clock.systemUTC());
255255
*
256-
* // assertion will pass as it is executed less than one second after actual was built
256+
* // assertion will pass as if executed less than one second after actual was built
257257
* assertThat(actual).isCloseToUtcNow(within(1, ChronoUnit.SECONDS));
258258
*
259259
* // assertion will fail
260260
* assertThat(actual.plusSeconds(2)).isCloseToUtcNow(within(1, ChronoUnit.SECONDS));</code></pre>
261-
*
261+
*
262262
* @param offset The offset used for comparison
263263
* @return this assertion object
264264
* @throws NullPointerException if {@code offset} parameter is {@code null}.

src/test/java/org/assertj/core/api/recursive/comparison/RecursiveComparisonAssert_isEqualTo_ignoringCollectionOrder_Test.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public void should_pass_for_objects_with_the_same_data_when_collection_order_is_
4141
.isEqualTo(expected);
4242
}
4343

44-
@SuppressWarnings("unused")
4544
private static Stream<Arguments> should_pass_for_objects_with_the_same_data_when_collection_order_is_ignored_source() {
4645
FriendlyPerson friendlyPerson1 = friend("Sherlock Holmes");
4746
friendlyPerson1.friends.add(friend("Dr. John Watson"));

0 commit comments

Comments
 (0)