Skip to content

Commit 244cd86

Browse files
Javadoc improvements
1 parent f002fc9 commit 244cd86

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,19 +1028,19 @@ public static <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(AtomicStamp
10281028
}
10291029

10301030
/**
1031-
* Allows to capture and then assert on a {@link Throwable} more easily when used with Java 8 lambdas.
1032-
*
1031+
* Allows to capture and then assert on a {@link Throwable} (easier done with lambdas).
10331032
* <p>
10341033
* Java 8 example :
10351034
* <pre><code class='java'> {@literal @}Test
10361035
* public void testException() {
10371036
* assertThatThrownBy(() -&gt; { throw new Exception("boom!") }).isInstanceOf(Exception.class)
1038-
* .hasMessageContaining("boom");
1037+
* .hasMessageContaining("boom");
10391038
* }</code></pre>
10401039
*
10411040
* If the provided {@link ThrowingCallable} does not raise an exception, an error is immediately raised,
10421041
* in that case the test description provided with {@link AbstractAssert#as(String, Object...) as(String, Object...)} is not honored.
10431042
* To use a test description, use {@link #catchThrowable(ThrowableAssert.ThrowingCallable)} as shown below.
1043+
*
10441044
* <pre><code class='java'> // assertion will fail but "display me" won't appear in the error
10451045
* assertThatThrownBy(() -&gt; { // do nothing }).as("display me").isInstanceOf(Exception.class);
10461046
*
@@ -1049,20 +1049,20 @@ public static <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(AtomicStamp
10491049
* assertThat(thrown).as("display me").isInstanceOf(Exception.class); </code></pre>
10501050
*
10511051
* @param shouldRaiseThrowable The {@link ThrowingCallable} or lambda with the code that should raise the throwable.
1052-
* @return The captured exception or <code>null</code> if none was raised by the callable.
1052+
* @return the created {@link ThrowableAssert}.
10531053
*/
10541054
@CheckReturnValue
10551055
public static AbstractThrowableAssert<?, ? extends Throwable> assertThatThrownBy(ThrowingCallable shouldRaiseThrowable) {
10561056
return assertThat(catchThrowable(shouldRaiseThrowable)).hasBeenThrown();
10571057
}
10581058

10591059
/**
1060-
* Allows to capture and then assert on a {@link Throwable} more easily when used with Java 8 lambdas.
1061-
*
1060+
* Allows to capture and then assert on a {@link Throwable} (easier done with lambdas).
1061+
* <p>
1062+
* The main difference with {@link #assertThatThrownBy(ThrowingCallable) assertThatThrownBy} is that
1063+
* this method does not fail if no exception was thrown.
10621064
* <p>
10631065
* Example :
1064-
* </p>
1065-
*
10661066
* <pre><code class='java'> ThrowingCallable callable = () -> {
10671067
* throw new Exception("boom!");
10681068
* };
@@ -1094,7 +1094,7 @@ public static <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(AtomicStamp
10941094
* This method was not named {@code assertThat} because the java compiler reported it ambiguous when used directly with a lambda :(
10951095
*
10961096
* @param shouldRaiseOrNotThrowable The {@link ThrowingCallable} or lambda with the code that should raise the throwable.
1097-
* @return The captured exception or <code>null</code> if none was raised by the callable.
1097+
* @return the created {@link ThrowableAssert}.
10981098
* @since 3.7.0
10991099
*/
11001100
@CheckReturnValue
@@ -1792,7 +1792,9 @@ public static TemporalUnitOffset byLessThan(long value, TemporalUnit unit) {
17921792
* @param <T> Type of the property under the assertion
17931793
* @return same instance of {@code extractor}
17941794
*/
1795-
public static <F, T> Function<F, T> from(Function<F, T> extractor) { return extractor; }
1795+
public static <F, T> Function<F, T> from(Function<F, T> extractor) {
1796+
return extractor;
1797+
}
17961798

17971799
// ------------------------------------------------------------------------------------------------------
17981800
// Condition methods : not assertions but here to have a single entry point to all AssertJ features.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
import org.assertj.core.util.CheckReturnValue;
8181

8282
/**
83-
*
8483
* A unified entry point to all non-deprecated assertions from both the new Java 8 core API and the pre-Java 8 core API.
8584
*
8685
* As a convenience, the methods are defined in an interface so that no static imports are necessary if the test class

0 commit comments

Comments
 (0)