Skip to content

Commit 7a033f8

Browse files
committed
Javadoc
1 parent 4cc1bc7 commit 7a033f8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/test/java/org/apache/commons/lang3/LangAssertions.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,45 @@
1919

2020
import static org.junit.jupiter.api.Assertions.assertThrows;
2121

22+
import org.junit.jupiter.api.Assertions;
2223
import org.junit.jupiter.api.function.Executable;
2324

2425
/**
2526
* Specialized APIs to complement {@link org.junit.jupiter.api.Assertions}.
2627
*/
2728
public class LangAssertions {
2829

30+
/**
31+
* Asserts that execution of the given {@code executable} throws a {@link NullPointerException}.
32+
*
33+
* <p>
34+
* The assertion passes if the thrown exception type is the same as {@link NullPointerException} or a subtype. To check for the exact thrown type
35+
* use {@link Assertions#assertThrowsExactly(Class, Executable) assertThrowsExactly}. If no exception is thrown, or if an exception of a different type is
36+
* thrown, this method fails.
37+
* </p>
38+
*
39+
* @param executable What to test.
40+
* @return The thrown NullPointerException.
41+
* @see Assertions#assertThrowsExactly(Class, Executable)
42+
*/
2943
public static NullPointerException assertNullPointerException(final Executable executable) {
3044
return assertThrows(NullPointerException.class, executable);
3145
}
3246

47+
/**
48+
* Asserts that execution of the given {@code executable} throws a {@link NullPointerException}.
49+
*
50+
* <p>
51+
* The assertion passes if the thrown exception type is the same as {@link NullPointerException} or a subtype. To check for the exact thrown type
52+
* use {@link Assertions#assertThrowsExactly(Class, Executable) assertThrowsExactly}. If no exception is thrown, or if an exception of a different type is
53+
* thrown, this method fails.
54+
* </p>
55+
*
56+
* @param executable What to test.
57+
* @param message The message for the failure if the executable doesn't throw a NullPointerException.
58+
* @return The thrown NullPointerException.
59+
* @see Assertions#assertThrowsExactly(Class, Executable)
60+
*/
3361
public static NullPointerException assertNullPointerException(final Executable executable, final String message) {
3462
return assertThrows(NullPointerException.class, executable, message);
3563
}

0 commit comments

Comments
 (0)