@Retention(value=RUNTIME)
@Target(value=TYPE)
@Inherited
@Documented
@API(status=EXPERIMENTAL,
since="1.10")
@Repeatable(value=SelectMethods.class)
public @interface SelectMethod
@SelectMethod is a repeatable annotation that
specifies a method to select when running a test suite on the JUnit
Platform.Suite,
JUnitPlatform,
DiscoverySelectors.selectMethod(String),
DiscoverySelectors.selectMethod(String, String, String),
DiscoverySelectors.selectMethod(String, String, Class...),
DiscoverySelectors.selectMethod(Class, String, String),
DiscoverySelectors.selectMethod(Class, String, Class...)| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.String |
name
The name of the method to select; never blank unless
value() is used. |
java.lang.String |
parameterTypeNames
The parameter types of the method to select.
|
java.lang.Class<?>[] |
parameterTypes
The parameter types of the method to select.
|
java.lang.Class<?> |
type
The class in which the method is declared, or a subclass thereof.
|
java.lang.String |
typeName
The fully qualified class name in which the method is declared, or a subclass thereof.
|
java.lang.String |
value
The fully qualified method name of the method to select.
|
public abstract java.lang.String value
The following formats are supported.
[fully qualified class name]#[methodName][fully qualified class name]#[methodName](parameter type list)
The parameter type list is a comma-separated list of primitive names or fully qualified class names for the types of parameters accepted by the method.
Array parameter types may be specified using either the JVM's internal
String representation (e.g., [[I for int[][],
[Ljava.lang.String; for java.lang.String[], etc.) or
source code syntax (e.g., int[][], java.lang.String[],
etc.).
| Method | Fully Qualified Method Name |
|---|---|
java.lang.String.chars() | java.lang.String#chars |
java.lang.String.chars() | java.lang.String#chars() |
java.lang.String.equalsIgnoreCase(String) | java.lang.String#equalsIgnoreCase(java.lang.String) |
java.lang.String.substring(int, int) | java.lang.String#substring(int, int) |
example.Calc.avg(int[]) | example.Calc#avg([I) |
example.Calc.avg(int[]) | example.Calc#avg(int[]) |
example.Matrix.multiply(double[][]) | example.Matrix#multiply([[D) |
example.Matrix.multiply(double[][]) | example.Matrix#multiply(double[][]) |
example.Service.process(String[]) | example.Service#process([Ljava.lang.String;) |
example.Service.process(String[]) | example.Service#process(java.lang.String[]) |
example.Service.process(String[][]) | example.Service#process([[Ljava.lang.String;) |
example.Service.process(String[][]) | example.Service#process(java.lang.String[][]) |
Cannot be combined with any other attribute.
DiscoverySelectors.selectMethod(String)public abstract java.lang.Class<?> type
Cannot be used in conjunction with typeName().
public abstract java.lang.String typeName
Cannot be used in conjunction with type().
public abstract java.lang.String name
value() is used.public abstract java.lang.Class<?>[] parameterTypes
Cannot be used in conjunction with parameterTypeNames().
public abstract java.lang.String parameterTypeNames
This is typically a comma-separated list of atomic types, fully qualified class names, or array types; however, the exact syntax depends on the underlying test engine.
If the method takes no parameters, this attribute must be an empty string.
Array parameter types may be specified using either the JVM's internal
String representation (e.g., [[I for int[][],
[Ljava.lang.String; for java.lang.String[], etc.) or
source code syntax (e.g., int[][], java.lang.String[],
etc.).
| Method | Parameter types list |
|---|---|
java.lang.String.chars() | The empty string |
java.lang.String.equalsIgnoreCase(String) | java.lang.String |
java.lang.String.substring(int, int) | int, int |
example.Calc.avg(int[]) | [I |
example.Calc.avg(int[]) | int[] |
example.Matrix.multiply(double[][]) | [[D |
example.Matrix.multiply(double[][]) | double[][] |
example.Service.process(String[]) | [Ljava.lang.String; |
example.Service.process(String[]) | java.lang.String[] |
example.Service.process(String[][]) | [[Ljava.lang.String; |
example.Service.process(String[][]) | java.lang.String[][] |
Cannot be used in conjunction with parameterTypes().