@@ -1028,19 +1028,19 @@ public static <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(AtomicStamp
1028
1028
}
1029
1029
1030
1030
/**
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).
1033
1032
* <p>
1034
1033
* Java 8 example :
1035
1034
* <pre><code class='java'> {@literal @}Test
1036
1035
* public void testException() {
1037
1036
* assertThatThrownBy(() -> { throw new Exception("boom!") }).isInstanceOf(Exception.class)
1038
- * .hasMessageContaining("boom");
1037
+ * .hasMessageContaining("boom");
1039
1038
* }</code></pre>
1040
1039
*
1041
1040
* If the provided {@link ThrowingCallable} does not raise an exception, an error is immediately raised,
1042
1041
* in that case the test description provided with {@link AbstractAssert#as(String, Object...) as(String, Object...)} is not honored.
1043
1042
* To use a test description, use {@link #catchThrowable(ThrowableAssert.ThrowingCallable)} as shown below.
1043
+ *
1044
1044
* <pre><code class='java'> // assertion will fail but "display me" won't appear in the error
1045
1045
* assertThatThrownBy(() -> { // do nothing }).as("display me").isInstanceOf(Exception.class);
1046
1046
*
@@ -1049,20 +1049,20 @@ public static <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(AtomicStamp
1049
1049
* assertThat(thrown).as("display me").isInstanceOf(Exception.class); </code></pre>
1050
1050
*
1051
1051
* @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} .
1053
1053
*/
1054
1054
@ CheckReturnValue
1055
1055
public static AbstractThrowableAssert <?, ? extends Throwable > assertThatThrownBy (ThrowingCallable shouldRaiseThrowable ) {
1056
1056
return assertThat (catchThrowable (shouldRaiseThrowable )).hasBeenThrown ();
1057
1057
}
1058
1058
1059
1059
/**
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.
1062
1064
* <p>
1063
1065
* Example :
1064
- * </p>
1065
- *
1066
1066
* <pre><code class='java'> ThrowingCallable callable = () -> {
1067
1067
* throw new Exception("boom!");
1068
1068
* };
@@ -1094,7 +1094,7 @@ public static <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(AtomicStamp
1094
1094
* This method was not named {@code assertThat} because the java compiler reported it ambiguous when used directly with a lambda :(
1095
1095
*
1096
1096
* @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} .
1098
1098
* @since 3.7.0
1099
1099
*/
1100
1100
@ CheckReturnValue
@@ -1792,7 +1792,9 @@ public static TemporalUnitOffset byLessThan(long value, TemporalUnit unit) {
1792
1792
* @param <T> Type of the property under the assertion
1793
1793
* @return same instance of {@code extractor}
1794
1794
*/
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
+ }
1796
1798
1797
1799
// ------------------------------------------------------------------------------------------------------
1798
1800
// Condition methods : not assertions but here to have a single entry point to all AssertJ features.
0 commit comments