Class NestedMethodSelector
- java.lang.Object
-
- org.junit.platform.engine.discovery.NestedMethodSelector
-
- All Implemented Interfaces:
DiscoverySelector
@API(status=STABLE, since="1.6") public class NestedMethodSelector extends Object implements DiscoverySelector
ADiscoverySelectorthat selects a nestedMethodor a combination of enclosing classes names, class name, method name, and parameter types so thatTestEnginescan discover tests or containers based on methods.If a Java
Methodis provided, the selector will return that method and its method name, class name, enclosing classes names and parameter types accordingly. If class or methods names are provided, this selector will only attempt to lazily load theClassandMethodifgetEnclosingClasses(),getNestedClass()orgetMethod()is invoked.In this context, a Java
Methodmeans anything that can be referenced as aMethodon the JVM — for example, methods from Java classes or methods from other JVM languages such Groovy, Scala, etc.- Since:
- 1.6
- See Also:
DiscoverySelectors.selectNestedMethod(List, String, String),DiscoverySelectors.selectNestedMethod(List, String, String, String),DiscoverySelectors.selectNestedMethod(List, Class, String),DiscoverySelectors.selectNestedMethod(List, Class, String, String),DiscoverySelectors.selectNestedMethod(List, Class, Method),MethodSource,NestedClassSelector,MethodSelector
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)List<Class<?>>getEnclosingClasses()List<String>getEnclosingClassNames()Get the names of the classes enclosing the nested class containing the selected method.MethodgetMethod()Get the selectedMethod.StringgetMethodName()Get the name of the selected method.StringgetMethodParameterTypes()Get the parameter types for the selected method as aString, typically a comma-separated list of primitive types, fully qualified class names, or array types.Class<?>getNestedClass()StringgetNestedClassName()Get the name of the nested class containing the selected method.inthashCode()StringtoString()
-
-
-
Method Detail
-
getEnclosingClassNames
public List<String> getEnclosingClassNames()
Get the names of the classes enclosing the nested class containing the selected method.
-
getEnclosingClasses
public List<Class<?>> getEnclosingClasses()
Get the list ofClassenclosing the nestedClasscontaining the selectedMethod.If the
Classwere not provided, but only the name of the nested class and its enclosing classes, this method attempts to lazily load the list of enclosingClassand throws aPreconditionViolationExceptionif the classes cannot be loaded.
-
getNestedClassName
public String getNestedClassName()
Get the name of the nested class containing the selected method.
-
getNestedClass
public Class<?> getNestedClass()
Get the nestedClasscontaining the selectedMethod.If the
Classwere not provided, but only the name of the nested class and its enclosing classes, this method attempts to lazily load the nestedClassand throws aPreconditionViolationExceptionif the class cannot be loaded.
-
getMethodName
public String getMethodName()
Get the name of the selected method.
-
getMethod
public Method getMethod()
Get the selectedMethod.If the
Methodwas not provided, but only the name, this method attempts to lazily load theMethodbased on its name and throws aPreconditionViolationExceptionif the method cannot be loaded.
-
getMethodParameterTypes
public String getMethodParameterTypes()
Get the parameter types for the selected method as aString, typically a comma-separated list of primitive types, fully qualified class names, or array types.Note: the parameter types are provided as a single string instead of a collection in order to allow this selector to be used in a generic fashion by various test engines. It is therefore the responsibility of the caller of this method to determine how to parse the returned string.
- Returns:
- the parameter types supplied to this
NestedMethodSelectorvia a constructor or deduced from aMethodsupplied via a constructor; nevernull
-
-