Skip to content

Commit

Permalink
Revert formatting changes in User Guide.
Browse files Browse the repository at this point in the history
Issue: #2677
  • Loading branch information
VladimirDmitrienko committed Sep 25, 2024
1 parent d56196d commit c8d26ef
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions documentation/src/docs/asciidoc/user-guide/writing-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2939,8 +2939,8 @@ In addition to controlling the execution mode using the `{Execution}` annotation
Jupiter provides another annotation-based declarative synchronization mechanism. The
`{ResourceLock}` annotation allows you to declare that a test class or method uses a
specific shared resource that requires synchronized access to ensure reliable test
execution. The shared resource is identified by a unique name which is a `String`.
The name can be user-defined or one of the predefined constants in `{Resources}`:
execution. The shared resource is identified by a unique name which is a `String`. The
name can be user-defined or one of the predefined constants in `{Resources}`:
`SYSTEM_PROPERTIES`, `SYSTEM_OUT`, `SYSTEM_ERR`, `LOCALE`, or `TIME_ZONE`.

`{ResourceLock}` annotation has 'providers' attribute
Expand All @@ -2956,13 +2956,12 @@ If the tests in the following examples were run in parallel _without_ the use of
Sometimes they would pass, and at other times they would fail due to
the inherent race condition of writing and then reading the same JVM System Property.

When access to shared resources is declared using the `{ResourceLock}` annotation
or added with `{ResourceLocksProvider}` interface, the JUnit Jupiter engine uses
this information to ensure that no conflicting tests are run in parallel.
This guarantee extends to lifecycle methods of a test class or method.
For example, if a test method is annotated with a `{ResourceLock}` annotation,
the "lock" will be acquired before any `@BeforeEach` methods are executed
and released after all `@AfterEach` methods have been executed.
When access to shared resources is declared using the `{ResourceLock}` annotation, the
JUnit Jupiter engine uses this information to ensure that no conflicting tests are run in
parallel. This guarantee extends to lifecycle methods of a test class or method. For
example, if a test method is annotated with a `{ResourceLock}` annotation, the "lock" will
be acquired before any `@BeforeEach` methods are executed and released after all
`@AfterEach` methods have been executed.

[NOTE]
.Running tests in isolation
Expand Down

0 comments on commit c8d26ef

Please sign in to comment.