forked from junit-team/junit5
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for combining multiple TestTemplate providers together, in a product style, so that an implementer can use the benefits of multiple extensions together. Issue: junit-team#1224
- Loading branch information
1 parent
7aebb42
commit 237b94d
Showing
2 changed files
with
127 additions
and
2 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
junit-jupiter-api/src/main/java/org/junit/jupiter/api/CombineTestTemplates.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,45 @@ | ||
/* | ||
* Copyright 2015-2020 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; | ||
|
||
import static org.apiguardian.api.API.Status.EXPERIMENTAL; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import org.apiguardian.api.API; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.api.extension.TestTemplateInvocationContext; | ||
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider; | ||
import org.junit.platform.commons.annotation.Testable; | ||
|
||
/** | ||
* Opt this test method into combining {@link TestTemplateInvocationContextProvider} instances together into a single | ||
* one. This means that the product of the tests will be run. This allows combining tests such as the { | ||
* @link RepeatedTest} and {@code ParameterizedTest} annotations. | ||
* <p> | ||
* <b>Note:</b> Not all {@link TestTemplateInvocationContextProvider} instances may be compatible with this. | ||
* Specifically: any implementation of {@link TestTemplateInvocationContextProvider} which does complex initilization | ||
* logic in the {@link TestTemplateInvocationContextProvider#provideTestTemplateInvocationContexts(ExtensionContext)} | ||
* method may not work. Extenstions that wish to support this option should instead to their work in an extension | ||
* that is created, new, each time {@link TestTemplateInvocationContext#getAdditionalExtensions()} is called. | ||
* </p> | ||
*/ | ||
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
@API(status = EXPERIMENTAL, since = "5.8") | ||
@Testable | ||
public @interface CombineTestTemplates { | ||
} |
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