Skip to content

Commit 2ad0bea

Browse files
committed
Polishing
1 parent f98d4b6 commit 2ad0bea

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

documentation/src/docs/asciidoc/user-guide/writing-tests.adoc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,9 @@ method references. All JUnit Jupiter assumptions are static methods in the
362362
include::{testDir}/example/AssumptionsDemo.java[tags=user_guide]
363363
----
364364

365-
NOTE: As of JUnit Jupiter 5.4, it is also possible to use methods from JUnit 4's
366-
`org.junit.Assume` class for assumptions. Specifically, JUnit Jupiter supports JUnit 4's
367-
`AssumptionViolatedException` to signal that a test should be aborted instead of marked
368-
as a failure.
365+
NOTE: It is also possible to use methods from JUnit 4's `org.junit.Assume` class for
366+
assumptions. Specifically, JUnit Jupiter supports JUnit 4's `AssumptionViolatedException`
367+
to signal that a test should be aborted instead of marked as a failure.
369368

370369
[[writing-tests-exceptions]]
371370
=== Exception Handling
@@ -377,19 +376,20 @@ in implementing assertions, and how to specifically assert non-throwing conditio
377376
[[writing-tests-exceptions-uncaught]]
378377
==== Uncaught Exceptions
379378

380-
In JUnit Jupiter, if an exception is thrown and not caught within the test method, the
381-
framework will mark the test as failed.
379+
In JUnit Jupiter, if an exception is thrown from a test method, a lifecycle method, or an
380+
extension and not caught within that test method, lifecycle method, or extension, the
381+
framework will mark the test or test class as failed.
382+
383+
In the following example, the `failsDueToUncaughtException()` method throws an
384+
`ArithmeticException`. Since the exception is not caught within the test method, JUnit
385+
Jupiter will mark the test as failed.
382386

383387
[source,java,indent=0]
384388
----
385389
include::{testDir}/example/exception/UncaughtExceptionHandlingDemo.java[tags=user_guide]
386390
----
387391

388-
In the above example, the `failsDueToUncaughtException()` method throws an
389-
`ArithmeticException`. Since the exception is not caught within the test method, JUnit
390-
Jupiter will mark the test as failed.
391-
392-
NOTE: It's important to clarify that specifying a `throws` clause in the test method has
392+
NOTE: It's important to note that specifying a `throws` clause in the test method has
393393
no effect on the outcome of the test. JUnit Jupiter does not interpret a `throws` clause
394394
as an expectation or assertion about what exceptions the test method should throw. A test
395395
fails only if an exception is thrown unexpectedly or if an assertion fails.
@@ -413,15 +413,15 @@ failure. However, Integrated Development Environments (IDEs) and other tools may
413413
distinguish between these two types of failures by checking whether the thrown exception
414414
is an instance of `AssertionError`.
415415

416+
In the following example, the `failsDueToUncaughtAssertionError()` method throws an
417+
`AssertionError`. Since the exception is not caught within the test method, JUnit Jupiter
418+
will mark the test as failed.
419+
416420
[source,java,indent=0]
417421
----
418422
include::{testDir}/example/exception/FailedAssertionDemo.java[tags=user_guide]
419423
----
420424

421-
In the above example, the `failsDueToUncaughtAssertionError()` method throws an
422-
`AssertionError`. Since the exception is not caught within the test method, JUnit Jupiter
423-
will mark the test as failed.
424-
425425
[[writing-tests-exceptions-expected]]
426426
==== Asserting Expected Exceptions
427427

0 commit comments

Comments
 (0)