Annotation Interface DimensionMethodSource
@Retention(RUNTIME)
@Target({PARAMETER,FIELD})
@Repeatable(List.class)
public @interface DimensionMethodSource
Reference to a method providing a Stream, Collection or array of constraint annotations
for a
TestTemplate.
The method will be invoked by the KafkaClusterExtension
to provide a list of constraints over which the test will parameterized.
The annotation should be used on a KafkaCluster-typed parameter of a
TestTemplate-annotated method.
The referenced method much be static and package- or publicly-accessible.
@ExtendWith(KafkaClusterExtension.class)
public class TemplateTest {
@TestTemplate
public void multipleClusterSizes(
@DimensionMethodSource("clusterSizes")
KafkaCluster cluster) throws Exception {
// ... your test code
}
static Stream<BrokerCluster> clusterSizes() {
return Stream.of(
mkAnnotation(BrokerCluster.class, 1),
mkAnnotation(BrokerCluster.class, 3));
}
}
*
If multiple such annotation are present there will be a test for each element of the Cartesian product
over each of the dimensions. If you want to execute a subset of the Cartesian
product you might find @ConstraintsMethodSource more convenient.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceThe interface List. -
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
value
String valueThe name of thestatic, package- orpublic-accessible method.- Returns:
- the string
-
-
-
clazz
Class<?> clazzThe class where defining the static method, or Void.class (default), if the method is defined with the class defining the annotation test.- Returns:
- the class
- Default:
- java.lang.Void.class
-