Class ReflectionUtils
java.lang.Object
org.antublue.test.engine.internal.ReflectionUtils
Class to implement methods to get test class fields / methods, caching the results
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanacceptsArgument(Method method, Argument argument) Method to return if a Method accepts an ArgumentfindAllClasses(String packageName) Method to find all classes with a package namefindAllClasses(URI uri) Method to find all classes for a URIgetAfterAllMethods(Class<?> clazz) Method to get a List of @TestEngine.AfterAll MethodsgetAfterEachMethods(Class<?> clazz) Method to get a List of @TestEngine.AfterEach MethodsgetArgumentField(Class<?> clazz) Method to get @TestEngine.Argument FieldgetArgumentsList(Class<?> clazz) Method to get a List of Arguments for a Classstatic MethodgetArgumentSupplierMethod(Class<?> clazz) Method to get a @TestEngine.ArgumentSupplier MethodgetAutoCloseFields(Class<?> clazz) Method to get a List of @TestEngine.AutoClose FieldsgetBeforeAllMethods(Class<?> clazz) Method to get a List of @TestEngine.BeforeAll MethodsgetBeforeEachMethods(Class<?> clazz) Method to get a List of @TestEngine.BeforeEach MethodsgetConcludeMethods(Class<?> clazz) Method to get a @TestEngine.Conclude Methodsstatic StringgetDisplayName(Class<?> clazz) Method to get a test method display namestatic StringgetDisplayName(Method method) Method to get a test method display namegetPrepareMethods(Class<?> clazz) Method to get a List of @TestEngine.Prepare MethodsgetTestMethods(Class<?> clazz) Method to get a List of @TestEngine.Test Methodsstatic voidMethod to instantiate an Objectstatic voidMethod to invoke a methodstatic voidMethod to invoke a methodstatic voidMethod to set a Fieldstatic voidsortClasses(List<Class<?>> classes) Method to sort a List of classes first by @TestEngine.Order annotation, then by display name / class namestatic voidsortMethods(List<Method> methods) Method to sort a List of methods first by @TestEngine.Order annotation, then alphabetically
-
Method Details
-
findAllClasses
Method to find all classes for a URI- Parameters:
uri- uri- Returns:
- the return value
-
findAllClasses
Method to find all classes with a package name- Parameters:
packageName- packageName- Returns:
- the return value
-
acceptsArgument
Method to return if a Method accepts an Argument- Parameters:
method- methodargument- argument- Returns:
- the return value
-
getArgumentSupplierMethod
Method to get a @TestEngine.ArgumentSupplier Method- Parameters:
clazz- class to inspect- Returns:
- Method the return value
-
getArgumentsList
Method to get a List of Arguments for a Class- Parameters:
clazz- class to inspect- Returns:
- list of Arguments
-
getPrepareMethods
Method to get a List of @TestEngine.Prepare Methods- Parameters:
clazz- class to inspect- Returns:
- list of Methods
-
getArgumentField
Method to get @TestEngine.Argument Field- Parameters:
clazz- class to inspect- Returns:
- Optional that contains an @TestEngine.Argument annotated Field if it exists or is empty
-
getAutoCloseFields
Method to get a List of @TestEngine.AutoClose Fields- Parameters:
clazz- class to inspect- Returns:
- List of Fields
-
getBeforeAllMethods
Method to get a List of @TestEngine.BeforeAll Methods- Parameters:
clazz- class to inspect- Returns:
- list of Methods
-
getBeforeEachMethods
Method to get a List of @TestEngine.BeforeEach Methods- Parameters:
clazz- class to inspect- Returns:
- list of Methods
-
getTestMethods
Method to get a List of @TestEngine.Test Methods- Parameters:
clazz- class to inspect- Returns:
- list of Methods
-
getAfterEachMethods
Method to get a List of @TestEngine.AfterEach Methods- Parameters:
clazz- class to inspect- Returns:
- list of Methods
-
getAfterAllMethods
Method to get a List of @TestEngine.AfterAll Methods- Parameters:
clazz- class to inspect- Returns:
- list of Methods
-
getConcludeMethods
Method to get a @TestEngine.Conclude Methods- Parameters:
clazz- class to inspect- Returns:
- Method the return value
-
getDisplayName
Method to get a test method display name- Parameters:
method- method to get the display name for- Returns:
- the display name
-
getDisplayName
Method to get a test method display name- Parameters:
clazz- class to get the display name for- Returns:
- the display name
-
instantiate
public static void instantiate(Class<?> clazz, Consumer<Object> objectConsumer, Consumer<Throwable> throwableConsumer) Method to instantiate an Object- Parameters:
clazz- clazzobjectConsumer- objectConsumerthrowableConsumer- throwableConsumer
-
setField
public static void setField(Object object, Field field, Object value, Consumer<Throwable> throwableConsumer) Method to set a Field- Parameters:
object- objectfield- fieldvalue- valuethrowableConsumer- throwableConsumer
-
invoke
Method to invoke a method- Parameters:
object- objectmethod- methodthrowableConsumer- throwableConsumer
-
invoke
public static void invoke(Object object, Method method, Object[] arguments, Consumer<Throwable> throwableConsumer) Method to invoke a method- Parameters:
object- objectmethod- methodarguments- argumentsthrowableConsumer- throwableConsumer
-
sortClasses
Method to sort a List of classes first by @TestEngine.Order annotation, then by display name / class name- Parameters:
classes- list of Classes to sort
-
sortMethods
Method to sort a List of methods first by @TestEngine.Order annotation, then alphabetically- Parameters:
methods- list of Methods to sort
-