Package org.junitpioneer.internal
Class PioneerUtils
java.lang.Object
org.junitpioneer.internal.PioneerUtils
Pioneer-internal utility class.
DO NOT USE THIS CLASS - IT MAY CHANGE SIGNIFICANTLY IN ANY MINOR UPDATE.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncartesianProduct
(List<List<?>> lists) static List<ExtensionContext>
findAllContexts
(ExtensionContext context) Find all (parent)ExtensionContext
s viaExtensionContext.getParent()
.findMethodCurrentOrEnclosing
(Class<?> clazz, String methodName, Class<?>... parameterTypes) Find the firstMethod
of the supplied class or interface that meets the specified criteria, beginning with the specified class or interface and traversing its enclosing classes until such a method is found or the top level class is reached.static String
nullSafeToString
(Object object) static <T> Class<T>
Replaces all primitive types with the appropriate wrapper types.
-
Method Details
-
distinctToSet
-
findMethodCurrentOrEnclosing
public static Optional<Method> findMethodCurrentOrEnclosing(Class<?> clazz, String methodName, Class<?>... parameterTypes) Find the firstMethod
of the supplied class or interface that meets the specified criteria, beginning with the specified class or interface and traversing its enclosing classes until such a method is found or the top level class is reached.The algorithm does not search for methods in
Object
.- Parameters:
clazz
- the class or interface in which to find the method; nevernull
methodName
- the name of the method to find; nevernull
or emptyparameterTypes
- the types of parameters accepted by the method, if any; nevernull
- Returns:
- an
Optional
containing the method found; nevernull
but potentially empty if no such method could be found - See Also:
-
findAllContexts
Find all (parent)ExtensionContext
s viaExtensionContext.getParent()
.- Parameters:
context
- the context for which to find all (parent) contexts; nevernull
- Returns:
- a list of all contexts, "outwards" in the
getParent
-order, beginning with the given context; nevernull
or empty
-
nullSafeToString
-
wrap
Replaces all primitive types with the appropriate wrapper types. Returns the passed argument if it's not a primitive according toClass.isPrimitive()
.- Returns:
- the wrapped class of the primitive type, or the passed class
- See Also:
-
cartesianProduct
-