Top Description Methods
org.junit.platform.suite.api

public @Interface SelectMethod

extends Annotation
Annotations
@Retention:RUNTIME
@Target:TYPE
@Inherited
@Documented
@API
status:MAINTAINED
since:1.13.3
@Repeatable:SelectMethods
Static Imports
org.apiguardian.api.API.Status.MAINTAINED

@SelectMethod is a repeatable annotation that specifies a method to select when running a test suite on the JUnit Platform.
Since
1.10
See Also
Suite, org.junit.platform.engine.discovery.DiscoverySelectors#selectMethod(String), org.junit.platform.engine.discovery.DiscoverySelectors#selectMethod(String, String, String), org.junit.platform.engine.discovery.DiscoverySelectors#selectMethod(String, String, Class...), org.junit.platform.engine.discovery.DiscoverySelectors#selectMethod(Class, String, String), org.junit.platform.engine.discovery.DiscoverySelectors#selectMethod(Class, String, Class...)

Method Summary

Modifier and TypeMethod and Description
public String
name()

The name of the method to select; never blank unless value() is used.

public String
parameterTypeNames()

The parameter types of the method to select.

public Class<?>[]
parameterTypes()

The parameter types of the method to select.

public Class<?>
type()

The class in which the method is declared, or a subclass thereof.

public String
typeName()

The fully qualified class name in which the method is declared, or a subclass thereof.

public String
value()

The fully qualified method name of the method to select.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

nameback to summary
public String name()

The name of the method to select; never blank unless value() is used.

parameterTypeNamesback to summary
public String parameterTypeNames()

The parameter types of the method to select.

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.).

Examples
MethodParameter 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().

parameterTypesback to summary
public Class<?>[] parameterTypes()

The parameter types of the method to select.

Cannot be used in conjunction with parameterTypeNames().

typeback to summary
public Class<?> type()

The class in which the method is declared, or a subclass thereof.

Cannot be used in conjunction with typeName().

typeNameback to summary
public String typeName()

The fully qualified class name in which the method is declared, or a subclass thereof.

Cannot be used in conjunction with type().

valueback to summary
public String value()

The fully qualified method name of the method to select.

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.).

Examples
MethodFully 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.

See Also
org.junit.platform.engine.discovery.DiscoverySelectors#selectMethod(String)