Annotation Interface SelectMethod


@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:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The name of the method to select; never blank unless value() is used.
    The parameter types of the method to select.
    Class<?>[]
    The parameter types of the method to select.
    The class in which the method is declared, or a subclass thereof.
    The fully qualified class name in which the method is declared, or a subclass thereof.
    The fully qualified method name of the method to select.
  • Element Details

    • value

      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:
      Default:
      ""
    • type

      Class<?> type
      The class in which the method is declared, or a subclass thereof.

      Cannot be used in conjunction with typeName().

      Default:
      java.lang.Class.class
    • typeName

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

      Cannot be used in conjunction with type().

      Default:
      ""
    • name

      String name
      The name of the method to select; never blank unless value() is used.
      Default:
      ""
    • parameterTypes

      Class<?>[] parameterTypes
      The parameter types of the method to select.

      Cannot be used in conjunction with parameterTypeNames().

      Default:
      {}
    • parameterTypeNames

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

      Default:
      ""