Skip to content

Commit fdec3f1

Browse files
committed
Apply suggestions from the code review
1 parent 933ef57 commit fdec3f1

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ JUnit repository on GitHub.
9090
* Allow determining "shared resources" at runtime via the new `@ResourceLock#providers`
9191
attribute that accepts implementations of `ResourceLocksProvider`.
9292
* Allow declaring "shared resources" for _direct_ child nodes via the new
93-
`@ResourceLock(target = CHILDREN)` attribute. It may improve parallelization when
93+
`@ResourceLock(target = CHILDREN)` attribute. This may improve parallelization when
9494
a test class declares a `READ` lock, but only a few methods hold a `READ_WRITE` lock.
9595
* Extensions that implement `TestInstancePreConstructCallback`, `TestInstanceFactory`,
9696
`TestInstancePostProcessor`, `ParameterResolver`, or `InvocationInterceptor` may

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,15 +3035,15 @@ the `{ResourceLockTarget}` enum.
30353035

30363036
Using the `target = CHILDREN` in a class-level `{ResourceLock}` annotation
30373037
has the same semantics as adding an annotation with the same `value` and `mode`
3038-
to each test method declared in this class.
3038+
to each test method and nested test class declared in this class.
30393039

3040-
It may improve parallelization when a test class declares a `READ` lock,
3040+
This may improve parallelization when a test class declares a `READ` lock,
30413041
but only a few methods hold a `READ_WRITE` lock.
30423042

30433043
Tests in the following example would run in the `SAME_THREAD` if the `{ResourceLock}`
3044-
doesn't have the `target = CHILDREN`. This is because the test class declares a `READ`
3044+
didn't have `target = CHILDREN`. This is because the test class declares a `READ`
30453045
shared resource, but one test method holds a `READ_WRITE` lock,
3046-
which forces the `SAME_THREAD` execution mode for all the test methods.
3046+
which would force the `SAME_THREAD` execution mode for all the test methods.
30473047

30483048
[source,java]
30493049
.Declaring shared resources for child nodes with `target` attribute

junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
*
6868
* <p>Using the {@link ResourceLockTarget#CHILDREN} in a class-level
6969
* annotation has the same semantics as adding an annotation with the same
70-
* {@link #value()} and {@link #mode()} to each test method declared
71-
* in this class.
70+
* {@link #value()} and {@link #mode()} to each test method and nested test
71+
* class declared in this class.
7272
*
73-
* <p>It may improve parallelization when a test class declares a
73+
* <p>This may improve parallelization when a test class declares a
7474
* {@link ResourceAccessMode#READ READ} lock, but only a few methods hold
7575
* {@link ResourceAccessMode#READ_WRITE READ_WRITE} lock.
7676
*

junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ public enum ResourceLockTarget {
3737
* <li>a test class
3838
* - test methods and nested test classes declared in the class.</li>
3939
* <li>a nested test class
40-
* - test methods declared in the nested class.</li>
41-
* <li>a test method - considered to have no children.</li>
40+
* - test methods and nested test classes declared in the nested class.
41+
* </li>
42+
* <li>a test method
43+
* - considered to have no children. Using {@code CHILDREN} for
44+
* a test method results in an exception.</li>
4245
* </ul>
4346
*/
4447
CHILDREN

0 commit comments

Comments
 (0)