Skip to content

Commit f45b882

Browse files
committed
Polishing
1 parent d9848df commit f45b882

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,9 +3128,9 @@ include::{testDir}/example/TempDirectoryDemo.java[tags=user_guide_field_injectio
31283128
----
31293129

31303130
The `@TempDir` annotation has an optional `cleanup` attribute that can be set to either
3131-
`NEVER`, `ON_SUCCESS`, or `ALWAYS`. If the cleanup mode is set to `NEVER`, temporary
3132-
directories are not deleted after a test completes. If it is set to `ON_SUCCESS`,
3133-
temporary directories are deleted only after a test completed successfully.
3131+
`NEVER`, `ON_SUCCESS`, or `ALWAYS`. If the cleanup mode is set to `NEVER`, the temporary
3132+
directory will not be deleted after the test completes. If it is set to `ON_SUCCESS`, the
3133+
temporary directory will only be deleted after the test if the test completed successfully.
31343134

31353135
The default cleanup mode is `ALWAYS`. You can use the
31363136
`junit.jupiter.tempdir.cleanup.mode.default`
@@ -3166,7 +3166,7 @@ prefix instead of the `junit` constant value.
31663166
include::{testDir}/example/TempDirectoryDemo.java[tags=user_guide_factory_name_prefix]
31673167
----
31683168

3169-
It's also possible to use an in-memory file system like `{Jimfs}` for the creation of the
3169+
It is also possible to use an in-memory file system like `{Jimfs}` for the creation of the
31703170
temporary directory. The following example demonstrates how to achieve that.
31713171

31723172
[source,java,indent=0]
@@ -3197,18 +3197,17 @@ include::{testDir}/example/TempDirectoryDemo.java[tags=user_guide_composed_annot
31973197
Meta-annotations or additional annotations on the field or parameter the `TempDir`
31983198
annotation is declared on might expose additional attributes to configure the factory.
31993199
Such annotations and related attributes can be accessed via the `AnnotatedElementContext`
3200-
parameter of `createTempDirectory`.
3200+
parameter of the `createTempDirectory(...)` method.
32013201

3202-
You can use the `junit.jupiter.tempdir.factory.default`
3203-
<<running-tests-config-params, configuration parameter>> to specify the fully qualified
3204-
class name of the `TempDirFactory` you would like to use by default. Just like for
3205-
factories configured via the `factory` attribute of the `@TempDir` annotation,
3206-
the supplied class has to implement the `TempDirFactory` interface. The default factory
3207-
will be used for all `@TempDir` annotations unless the `factory` attribute of the
3208-
annotation specifies a different factory.
3202+
You can use the `junit.jupiter.tempdir.factory.default` <<running-tests-config-params,
3203+
configuration parameter>> to specify the fully qualified class name of the
3204+
`TempDirFactory` you would like to use by default. Just like for factories configured via
3205+
the `factory` attribute of the `@TempDir` annotation, the supplied class has to implement
3206+
the `TempDirFactory` interface. The default factory will be used for all `@TempDir`
3207+
annotations unless the `factory` attribute of the annotation specifies a different factory.
32093208

3210-
In summary, the factory for a temporary directory is determined according to the
3211-
following precedence rules:
3209+
In summary, the factory for a temporary directory is determined according to the following
3210+
precedence rules:
32123211

32133212
1. The `factory` attribute of the `@TempDir` annotation, if present
32143213
2. The default `TempDirFactory` configured via the configuration

junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDir.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@
4646
* cases:
4747
*
4848
* <ul>
49-
* <li>If the field type or parameter type is neither {@link Path} nor
50-
{@link File}.</li>
49+
* <li>If the field type or parameter type is neither {@code Path} nor {@code File}.</li>
5150
* <li>If a field is declared as {@code final}.</li>
5251
* <li>If the temporary directory cannot be created.</li>
5352
* <li>If the field type or parameter type is {@code File} and a custom
54-
* {@linkplain TempDir#factory() factory} is used, which creates a temporary
53+
* {@link TempDir#factory() factory} is used, which creates a temporary
5554
* directory that does not belong to the
5655
* {@linkplain java.nio.file.FileSystems#getDefault() default file system}.
5756
* </li>
@@ -154,9 +153,10 @@
154153
* <h4>Supported Values</h4>
155154
* <ul>
156155
* <li>{@code per_context}: creates a single temporary directory for the
157-
* entire test class or method, depending on where it's first declared
156+
* entire test class or method, depending on where {@code @TempDir} is first
157+
* declared</li>
158158
* <li>{@code per_declaration}: creates separate temporary directories for
159-
* each declaration site of the {@code @TempDir} annotation.
159+
* each declaration site of the {@code @TempDir} annotation</li>
160160
* </ul>
161161
*
162162
* <p>If not specified, the default is {@code per_declaration}.

0 commit comments

Comments
 (0)