-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce per-invocation lifecycle callbacks for container templates (#…
- Loading branch information
1 parent
0068c24
commit 517b9c0
Showing
23 changed files
with
595 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+110 KB
(150%)
documentation/src/docs/asciidoc/user-guide/images/extensions_lifecycle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5.66 KB
(64%)
documentation/src/docs/asciidoc/user-guide/images/extensions_lifecycle_source.docx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...c/main/java/org/junit/jupiter/api/extension/AfterContainerTemplateInvocationCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright 2015-2025 the original author or authors. | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License v2.0 which | ||
* accompanies this distribution and is available at | ||
* | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
*/ | ||
|
||
package org.junit.jupiter.api.extension; | ||
|
||
import static org.apiguardian.api.API.Status.EXPERIMENTAL; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* {@code AfterContainerTemplateInvocationCallback} defines the API for | ||
* {@link Extension Extensions} that wish to provide additional behavior | ||
* <strong>once</strong> before each invocation of a | ||
* {@linkplain org.junit.jupiter.api.ContainerTemplate container template}. | ||
* | ||
* <p>Concrete implementations often implement | ||
* {@link BeforeContainerTemplateInvocationCallback} | ||
* as well. | ||
* | ||
* <h2>Constructor Requirements</h2> | ||
* | ||
* <p>Consult the documentation in {@link Extension} for details on | ||
* constructor requirements. | ||
* | ||
* <h2>Wrapping Behavior</h2> | ||
* | ||
* <p>JUnit Jupiter guarantees <em>wrapping behavior</em> for multiple | ||
* registered extensions that implement lifecycle callbacks such as | ||
* {@link BeforeAllCallback}, {@link AfterAllCallback}, | ||
* {@link AfterContainerTemplateInvocationCallback}, | ||
* {@link AfterContainerTemplateInvocationCallback}, {@link BeforeEachCallback}, | ||
* {@link AfterEachCallback}, {@link BeforeTestExecutionCallback}, and | ||
* {@link AfterTestExecutionCallback}. | ||
* | ||
* <p>That means that, given two extensions {@code Extension1} and | ||
* {@code Extension2} with {@code Extension1} registered before | ||
* {@code Extension2}, any "before" callbacks implemented by {@code Extension1} | ||
* are guaranteed to execute before any "before" callbacks implemented by | ||
* {@code Extension2}. Similarly, given the two same two extensions registered | ||
* in the same order, any "after" callbacks implemented by {@code Extension1} | ||
* are guaranteed to execute after any "after" callbacks implemented by | ||
* {@code Extension2}. {@code Extension1} is therefore said to <em>wrap</em> | ||
* {@code Extension2}. | ||
* | ||
* @since 5.13 | ||
* @see org.junit.jupiter.api.ContainerTemplate | ||
* @see BeforeContainerTemplateInvocationCallback | ||
* @see BeforeAllCallback | ||
* @see AfterAllCallback | ||
* @see BeforeEachCallback | ||
* @see AfterEachCallback | ||
* @see BeforeTestExecutionCallback | ||
* @see AfterTestExecutionCallback | ||
*/ | ||
@FunctionalInterface | ||
@API(status = EXPERIMENTAL, since = "5.13") | ||
public interface AfterContainerTemplateInvocationCallback extends Extension { | ||
|
||
/** | ||
* Callback that is invoked <em>after</em> each invocation of a container | ||
* template. | ||
* | ||
* @param context the current extension context; never {@code null} | ||
*/ | ||
void afterContainerTemplateInvocation(ExtensionContext context) throws Exception; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.