Skip to content

Commit

Permalink
Generated by gradle-git-publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
junit-builds committed Jun 17, 2023
1 parent 7f22ddd commit 65e852c
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,29 @@ <h1 title="Interface TestWatcher" class="title">Interface TestWatcher</h1>
<a href="../TestTemplate.html" title="annotation interface in org.junit.jupiter.api"><code>@TestTemplate</code></a> methods (e.g.,
<code>@RepeatedTest</code> and <code>@ParameterizedTest</code>). Moreover, if there is a
failure at the class level &mdash; for example, an exception thrown by a
<code>@BeforeAll</code> method &mdash; no test results will be reported.
<code>@BeforeAll</code> method &mdash; no test results will be reported. Similarly,
if the test class is disabled via an <a href="ExecutionCondition.html" title="interface in org.junit.jupiter.api.extension"><code>ExecutionCondition</code></a> &mdash; for
example, <code>@Disabled</code> &mdash; no test results will be reported.

<p>Extensions implementing this API can be registered at any level.
<p>Extensions implementing this interface can be registered at the class level,
instance level, or method level. When registered at the class level, a
<code>TestWatcher</code> will be invoked for any contained test method including
those in <a href="../Nested.html" title="annotation interface in org.junit.jupiter.api"><code>@Nested</code></a> classes. When registered
at the method level, a <code>TestWatcher</code> will only be invoked for the test
method for which it was registered.

<p><strong>WARNING</strong>: If a <code>TestWatcher</code> is registered via a
non-static (instance) field &mdash; for example, using
<a href="RegisterExtension.html" title="annotation interface in org.junit.jupiter.api.extension"><code>@RegisterExtension</code></a> &mdash; and the test class is
configured with
<a href="../TestInstance.html" title="annotation interface in org.junit.jupiter.api"><code>@TestInstance(Lifecycle.PER_METHOD)</code></a>
semantics (which is the default lifecycle mode), the <code>TestWatcher</code> will
<strong>not</strong> be invoked with events for <code>@TestTemplate</code> methods
(such as <code>@RepeatedTest</code> and <code>@ParameterizedTest</code>). To ensure that
a <code>TestWatcher</code> is invoked for all test methods in a given class, it is
therefore recommended that the <code>TestWatcher</code> be registered at the class
level with <a href="ExtendWith.html" title="annotation interface in org.junit.jupiter.api.extension"><code>@ExtendWith</code></a> or via a <code>static</code> field with
<code>@RegisterExtension</code> or <code>@ExtendWith</code>.

<h2>Exception Handling</h2>

Expand Down
8 changes: 4 additions & 4 deletions docs/snapshot/published-checksum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
112012410d193c0d9ccdfee9262df766 junit-platform-console/src/main/java/org/junit/platform/console/options/Theme.java
1204b968c0f6e2a77a5182e93ca40850 documentation/src/test/java/example/testinterface/TimeExecutionLogger.java
12e6cede69d624681253faf7f4e7dc72 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java
1384cd1694204c7d8f3ecd75923fa29d junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestWatcher.java
13ac972a60f544ea62f381731d18990c documentation/src/docs/asciidoc/release-notes/release-notes-5.9.3.adoc
13b704e483d5aebff444f2f2617d6d13 junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java
13c76a7853cbb65c8d2f2330aac9495d documentation/src/docs/asciidoc/user-guide/api-evolution.adoc
Expand Down Expand Up @@ -112,7 +113,6 @@
27be2636edd19cfe69859dd625d8428e junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java
28729167f2f8c799b1adcf791b6eb8c5 junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListener.java
29057d19138e6a1789282dab10852068 documentation/src/test/java/org/junit/api/tools/ApiReportWriter.java
292f0c98757dae9a6a851fab43269b09 documentation/src/docs/asciidoc/user-guide/writing-tests.adoc
29c26ee04d42ebbf571e649ec73efd38 junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/Executable.java
2a6a22322d0d2efe52021bc0bd99ec62 junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIf.java
2a7cd23c9bfc98f69fb16e08258d68cd documentation/src/test/java/example/callbacks/Extension2.java
Expand Down Expand Up @@ -431,7 +431,6 @@
886cf74e6f1023545a05b0bc90e50895 junit-platform-commons/src/main/java/org/junit/platform/commons/util/BlacklistedExceptions.java
89406f40f711e284ed7587f18cca0c3d junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectPackages.java
894cd93bbd1a6429c6436f2a42dcdac2 junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java
894d4fdfd675fd5c16deff22988327ac documentation/src/docs/asciidoc/release-notes/release-notes-5.10.0-RC1.adoc
89718e551cfe40a123823f221bebaa67 documentation/src/docs/asciidoc/resources/themes/junit-pdf-theme.yml
8a6fdf2c7fa46f893c68582f17f13899 documentation/src/test/java/example/callbacks/Extension1.java
8ab93885ec7ce9ba1cb478868a626df2 junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameter.java
Expand All @@ -453,6 +452,7 @@
8e55271e059d61a358c47b14d1f7d37d junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java
8e7a61177333442cc4091cb0120cac2b junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExpectedExceptionAdapter.java
8e8c9ec287e466507d377a1e21c6da05 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java
8f07b10063d7990c34d34064d70da1cb documentation/src/docs/asciidoc/user-guide/extensions.adoc
8f357407fbea6d14e5d5bfc06cd2ba91 junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java
8f3fd10378f55fad8e1375dc0d5036a0 documentation/src/main/java/example/registration/WebClient.java
8fd8ad2e0c863f13e264f6b909cc853a junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java
Expand Down Expand Up @@ -672,7 +672,6 @@ d28b3e91877ea7fbf00d9da522ddbe62 junit-platform-commons/src/main/java/org/junit
d2be4fa991bbe0384ec7634181fb9a39 junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/DefensiveAllDefaultPossibilitiesBuilder.java
d2cd75e732ece74152936ee110ae8aae junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java
d326da5d0e593b5edfa469bb74775852 junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LoggerFactory.java
d3627eb81c5a050982ac1601a5b41c21 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestWatcher.java
d3a42f95383f057d5f44fe3598bd3832 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java
d3cc17a3f4c29efd2bc18717bf4e87a9 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java
d3f72638028afd38f7788243c955d035 junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/Arguments.java
Expand All @@ -682,6 +681,7 @@ d48ca497e27808531a970f7782107993 junit-vintage-engine/src/main/java/org/junit/v
d492c4ceae12bdb9bc72d7aed56dd848 junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepetitionInfo.java
d4ce47495afb2233161e3f4241bc9f98 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/package-info.java
d4fe811c167b6bbaf3f427b4a26faa0b junit-jupiter-api/src/main/java/org/junit/jupiter/api/package-info.java
d5667831a21d08e0076e10c6af2e743c documentation/src/docs/asciidoc/user-guide/writing-tests.adoc
d57aa7f36c6865c8bed7dd85c0d7d817 junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java
d5a5df4157565c26820a164f93d92d17 documentation/src/docs/asciidoc/release-notes/release-notes-5.9.1.adoc
d60c79c8a58652feb53122397b0d138b junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Isolated.java
Expand All @@ -701,7 +701,6 @@ d8bd8a82228a73deaf1be8317da6e6e5 junit-vintage-engine/src/main/java/org/junit/v
d8de75eb134ac62780487423cf8f837e junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodSourceSupport.java
d8f765cdaae86ca58de5ebf87d38ef59 junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeClassNamePatterns.java
d9c4b2ecfd40ab714e5f249ab1d1641a documentation/src/docs/asciidoc/user-guide/advanced-topics/testkit.adoc
d9c99fb6f5075437d1f58af91c3a9a0c documentation/src/docs/asciidoc/user-guide/extensions.adoc
d9d5c16c9edfc6011816243e3099211b junit-platform-launcher/src/main/java/org/junit/platform/launcher/package-info.java
da369510c5511b2e45b273e801ebfb7e junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LogRecordListener.java
da3c11f05b4ff820a370b533f787a5ad documentation/src/test/java/example/callbacks/BrokenLifecycleMethodConfigDemo.java
Expand Down Expand Up @@ -798,6 +797,7 @@ f242b37228066e16d01bb991cb8f3984 documentation/src/test/resources/two-column.cs
f2abd6914fa1388f41e838d36c992bf7 junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListener.java
f2bd8b13217a0bfcf9eea994cc985146 documentation/src/test/java/example/RepeatedTestsDemo.java
f2d749426e057a52ef1c9012ea02ddb9 documentation/src/test/java/example/SuiteDemo.java
f41369d2988b830604d4c3fb9e02c6cc documentation/src/docs/asciidoc/release-notes/release-notes-5.10.0-RC1.adoc
f56706c8fb3402050810d3b98a2dab4b junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSource.java
f64807b6069430b9144c0c35f791f663 junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/OutcomeDelayingEngineExecutionListener.java
f660db4c94a92103ab602456dea90e6f documentation/src/test/java/org/junit/api/tools/AbstractApiReportWriter.java
Expand Down
6 changes: 5 additions & 1 deletion docs/snapshot/release-notes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ <h4 id="new-features-and-improvements-2"><a class="anchor" href="#new-features-a
includes an example implementation of the <code>RandomNumberExtension</code> in order to improve
the documentation for extension registration via <code>@ExtendWith</code> on fields.</p>
</li>
<li>
<p>The scope of applicability for <code>TestWatcher</code> implementations is now more extensively
documented in the User Guide and Javadoc.</p>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -1271,7 +1275,7 @@ <h2 id="release-notes-5.9.0"><a class="anchor" href="#release-notes-5.9.0"></a>5
<div id="footer">
<div id="footer-text">
Version 5.10.0-SNAPSHOT<br>
Last updated 2023-06-17 12:08:36 UTC
Last updated 2023-06-17 16:11:57 UTC
</div>
</div>
<script src="../tocbot-3.0.2/tocbot.min.js"></script>
Expand Down
1 change: 0 additions & 1 deletion docs/snapshot/user-guide/images/component-diagram.svg

This file was deleted.

84 changes: 59 additions & 25 deletions docs/snapshot/user-guide/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2611,8 +2611,7 @@ <h3 id="writing-tests-test-execution-order"><a class="anchor" href="#writing-tes
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
See <a href="#writing-tests-classes-and-methods">Test Classes and Methods</a> for a definition of <em>test method</em> and
<em>test class</em>.
See <a href="#writing-tests-definitions">Definitions</a> for a definition of <em>test method</em> and <em>test class</em>.
</td>
</tr>
</table>
Expand Down Expand Up @@ -2868,8 +2867,8 @@ <h3 id="writing-tests-test-instance-lifecycle"><a class="anchor" href="#writing-
<p>In order to allow individual test methods to be executed in isolation and to avoid
unexpected side effects due to mutable test instance state, JUnit creates a new instance
of each test class before executing each <em>test method</em> (see
<a href="#writing-tests-classes-and-methods">Test Classes and Methods</a>). This "per-method" test instance lifecycle is the
default behavior in JUnit Jupiter and is analogous to all previous versions of JUnit.</p>
<a href="#writing-tests-definitions">Definitions</a>). This "per-method" test instance lifecycle is the default
behavior in JUnit Jupiter and is analogous to all previous versions of JUnit.</p>
</div>
<div class="admonitionblock note">
<table>
Expand Down Expand Up @@ -3122,8 +3121,8 @@ <h3 id="writing-tests-dependency-injection"><a class="anchor" href="#writing-tes
<div class="paragraph">
<p><code><a href="../api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ParameterResolver.html">ParameterResolver</a></code> defines the API for test extensions that wish to <em>dynamically</em>
resolve parameters at runtime. If a <em>test class</em> constructor, a <em>test method</em>, or a
<em>lifecycle method</em> (see <a href="#writing-tests-classes-and-methods">Test Classes and Methods</a>) accepts a parameter, the
parameter must be resolved at runtime by a registered <code>ParameterResolver</code>.</p>
<em>lifecycle method</em> (see <a href="#writing-tests-definitions">Definitions</a>) accepts a parameter, the parameter
must be resolved at runtime by a registered <code>ParameterResolver</code>.</p>
</div>
<div class="paragraph">
<p>There are currently three built-in resolvers that are registered automatically.</p>
Expand Down Expand Up @@ -9363,11 +9362,11 @@ <h3 id="extensions-parameter-resolution"><a class="anchor" href="#extensions-par
</div>
<div class="paragraph">
<p>If a <em>test class</em> constructor, <em>test method</em>, or <em>lifecycle method</em> (see
<a href="#writing-tests-classes-and-methods">Test Classes and Methods</a>) declares a parameter, the parameter must be
<em>resolved</em> at runtime by a <code>ParameterResolver</code>. A <code>ParameterResolver</code> can either be
built-in (see <code><a href="https://github.com/junit-team/junit5/tree/HEAD/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java">TestInfoParameterResolver</a></code>) or <a href="#extensions-registration">registered by
the user</a>. Generally speaking, parameters may be resolved by <em>name</em>, <em>type</em>,
<em>annotation</em>, or any combination thereof.</p>
<a href="#writing-tests-definitions">Definitions</a>) declares a parameter, the parameter must be <em>resolved</em> at
runtime by a <code>ParameterResolver</code>. A <code>ParameterResolver</code> can either be built-in (see
<code><a href="https://github.com/junit-team/junit5/tree/HEAD/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java">TestInfoParameterResolver</a></code>) or <a href="#extensions-registration">registered by the user</a>.
Generally speaking, parameters may be resolved by <em>name</em>, <em>type</em>, <em>annotation</em>, or any
combination thereof.</p>
</div>
<div class="paragraph">
<p>If you wish to implement a custom <code><a href="../api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ParameterResolver.html">ParameterResolver</a></code> that resolves parameters based
Expand Down Expand Up @@ -9462,17 +9461,53 @@ <h3 id="extensions-test-result-processing"><a class="anchor" href="#extensions-t
</td>
<td class="content">
In contrast to the definition of "test method" presented in
<a href="#writing-tests-classes-and-methods">Test Classes and Methods</a>, in this context <em>test method</em> refers to any
<code>@Test</code> method or <code>@TestTemplate</code> method (for example, a <code>@RepeatedTest</code> or
<code>@ParameterizedTest</code>).
<a href="#writing-tests-definitions">Definitions</a>, in this context <em>test method</em> refers to any <code>@Test</code> method
or <code>@TestTemplate</code> method (for example, a <code>@RepeatedTest</code> or <code>@ParameterizedTest</code>).
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Extensions implementing this interface can be registered at the method level or at the
class level. In the latter case they will be invoked for any contained <em>test method</em>
including those in <code>@Nested</code> classes.</p>
<p>Extensions implementing this interface can be registered at the class level, instance
level, or method level. When registered at the class level, a <code>TestWatcher</code> will be
invoked for any contained <em>test method</em> including those in <code>@Nested</code> classes. When
registered at the method level, a <code>TestWatcher</code> will only be invoked for the <em>test method</em>
for which it was registered.</p>
</div>
<div class="admonitionblock warning">
<table>
<tr>
<td class="icon">
<i class="fa icon-warning" title="Warning"></i>
</td>
<td class="content">
<div class="paragraph">
<p>If a <code>TestWatcher</code> is registered via a non-static (instance) field – for example, using
<code>@RegisterExtension</code> – and the test class is configured with
<code>@TestInstance(Lifecycle.PER_METHOD)</code> semantics (which is the default lifecycle mode), the
<code>TestWatcher</code> will <strong>not</strong> be invoked with events for <code>@TestTemplate</code> methods (for
example, <code>@RepeatedTest</code> or <code>@ParameterizedTest</code>).</p>
</div>
<div class="paragraph">
<p>To ensure that a <code>TestWatcher</code> is invoked for all <em>test methods</em> in a given class, it is
therefore recommended that the <code>TestWatcher</code> be registered at the class level with
<code>@ExtendWith</code> or via a <code>static</code> field with <code>@RegisterExtension</code> or <code>@ExtendWith</code>.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>If there is a failure at the class level — for example, an exception thrown by a
<code>@BeforeAll</code> method — no test results will be reported. Similarly, if the test class is
disabled via an <code>ExecutionCondition</code> — for example, <code>@Disabled</code> — no test results will be
reported.</p>
</div>
<div class="paragraph">
<p>In contrast to other Extension APIs, a <code>TestWatcher</code> is not permitted to adversely
influence the execution of tests. Consequently, any exception thrown by a method in the
<code>TestWatcher</code> API will be logged at <code>WARNING</code> level and will not be allowed to propagate
or fail test execution.</p>
</div>
<div class="admonitionblock warning">
<table>
Expand All @@ -9483,9 +9518,9 @@ <h3 id="extensions-test-result-processing"><a class="anchor" href="#extensions-t
<td class="content">
<div class="paragraph">
<p>Any instances of <code>ExtensionContext.Store.CloseableResource</code> stored in the <code>Store</code> of the
provided <code><a href="../api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtensionContext.html">ExtensionContext</a></code> will be closed <em>before</em> methods in this API are invoked (see
<a href="#extensions-keeping-state">Keeping State in Extensions</a>). You can use the parent context&#8217;s <code>Store</code> to work with such
resources.</p>
provided <code><a href="../api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtensionContext.html">ExtensionContext</a></code> will be closed <em>before</em> methods in the <code>TestWatcher</code> API are
invoked (see <a href="#extensions-keeping-state">Keeping State in Extensions</a>). You can use the parent context&#8217;s <code>Store</code> to
work with such resources.</p>
</div>
</td>
</tr>
Expand Down Expand Up @@ -10112,7 +10147,7 @@ <h4 id="extensions-execution-order-wrapping-behavior"><a class="anchor" href="#e
</div>
<div class="paragraph">
<p>JUnit Jupiter also guarantees <em>wrapping</em> behavior within class and interface hierarchies
for user-supplied <em>lifecycle methods</em> (see <a href="#writing-tests-classes-and-methods">Test Classes and Methods</a>).</p>
for user-supplied <em>lifecycle methods</em> (see <a href="#writing-tests-definitions">Definitions</a>).</p>
</div>
<div class="ulist">
<ul>
Expand Down Expand Up @@ -10487,9 +10522,8 @@ <h4 id="extensions-execution-order-wrapping-behavior"><a class="anchor" href="#e
<td class="content">
<div class="paragraph">
<p>Due to the aforementioned behavior, the JUnit Team recommends that developers declare at
most one of each type of <em>lifecycle method</em> (see <a href="#writing-tests-classes-and-methods">Test Classes and Methods</a>)
per test class or test interface unless there are no dependencies between such lifecycle
methods.</p>
most one of each type of <em>lifecycle method</em> (see <a href="#writing-tests-definitions">Definitions</a>) per test
class or test interface unless there are no dependencies between such lifecycle methods.</p>
</div>
</td>
</tr>
Expand Down Expand Up @@ -12592,7 +12626,7 @@ <h3 id="dependency-diagram"><a class="anchor" href="#dependency-diagram"></a>10.
<div id="footer">
<div id="footer-text">
Version 5.10.0-SNAPSHOT<br>
Last updated 2023-06-17 12:08:36 UTC
Last updated 2023-06-17 16:11:58 UTC
</div>
</div>
<script src="../tocbot-3.0.2/tocbot.min.js"></script>
Expand Down

0 comments on commit 65e852c

Please sign in to comment.