You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/07/04 21:20:32 UTC

(commons-lang) 06/08: Javadoc

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 7a033f8d2ffedd0328271409b1cb6cb4d5f3250d
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Fri Jul 4 14:39:17 2025 -0400

    Javadoc
---
 .../org/apache/commons/lang3/LangAssertions.java   | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/test/java/org/apache/commons/lang3/LangAssertions.java b/src/test/java/org/apache/commons/lang3/LangAssertions.java
index 995ff498b..e6647f603 100644
--- a/src/test/java/org/apache/commons/lang3/LangAssertions.java
+++ b/src/test/java/org/apache/commons/lang3/LangAssertions.java
@@ -19,6 +19,7 @@
 
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.function.Executable;
 
 /**
@@ -26,10 +27,37 @@
  */
 public class LangAssertions {
 
+    /**
+     * Asserts that execution of the given {@code executable} throws a {@link NullPointerException}.
+     *
+     * <p>
+     * The assertion passes if the thrown exception type is the same as {@link NullPointerException} or a subtype. To check for the exact thrown type
+     * use {@link Assertions#assertThrowsExactly(Class, Executable) assertThrowsExactly}. If no exception is thrown, or if an exception of a different type is
+     * thrown, this method fails.
+     * </p>
+     *
+     * @param executable What to test.
+     * @return The thrown NullPointerException.
+     * @see Assertions#assertThrowsExactly(Class, Executable)
+     */
     public static NullPointerException assertNullPointerException(final Executable executable) {
         return assertThrows(NullPointerException.class, executable);
     }
 
+    /**
+     * Asserts that execution of the given {@code executable} throws a {@link NullPointerException}.
+     *
+     * <p>
+     * The assertion passes if the thrown exception type is the same as {@link NullPointerException} or a subtype. To check for the exact thrown type
+     * use {@link Assertions#assertThrowsExactly(Class, Executable) assertThrowsExactly}. If no exception is thrown, or if an exception of a different type is
+     * thrown, this method fails.
+     * </p>
+     *
+     * @param executable What to test.
+     * @param message The message for the failure if the executable doesn't throw a NullPointerException.
+     * @return The thrown NullPointerException.
+     * @see Assertions#assertThrowsExactly(Class, Executable)
+     */
     public static NullPointerException assertNullPointerException(final Executable executable, final String message) {
         return assertThrows(NullPointerException.class, executable, message);
     }