- java.lang.Object
-
- org.junitpioneer.internal.PioneerUtils
-
public class PioneerUtils extends java.lang.ObjectPioneer-internal utility class. DO NOT USE THIS CLASS - IT MAY CHANGE SIGNIFICANTLY IN ANY MINOR UPDATE.- See Also:
PioneerAnnotationUtils
-
-
Constructor Summary
Constructors Modifier Constructor Description privatePioneerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static <T> voidaddButThrowIfDuplicate(java.util.Set<T> set, T element)static java.util.List<java.util.List<?>>cartesianProduct(java.util.List<java.util.List<?>> lists)static java.util.LocalecreateLocale(java.lang.String language)static java.util.LocalecreateLocale(java.lang.String language, java.lang.String country)static java.util.LocalecreateLocale(java.lang.String language, java.lang.String country, java.lang.String variant)static <T> java.util.stream.Collector<T,java.util.Set<T>,java.util.Set<T>>distinctToSet()AtoSetcollector that throws anIllegalStateExceptionon duplicate elements (according toequals).static java.util.List<org.junit.jupiter.api.extension.ExtensionContext>findAllContexts(org.junit.jupiter.api.extension.ExtensionContext context)Find all (parent)ExtensionContexts viaExtensionContext.getParent().static java.util.Optional<java.lang.reflect.Method>findMethodCurrentOrEnclosing(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... parameterTypes)Find the firstMethodof 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 java.lang.StringnullSafeToString(java.lang.Object object)static <T> java.lang.Class<T>wrap(java.lang.Class<T> clazz)Replaces all primitive types with the appropriate wrapper types.
-
-
-
Method Detail
-
distinctToSet
public static <T> java.util.stream.Collector<T,java.util.Set<T>,java.util.Set<T>> distinctToSet()
AtoSetcollector that throws anIllegalStateExceptionon duplicate elements (according toequals).
-
addButThrowIfDuplicate
private static <T> void addButThrowIfDuplicate(java.util.Set<T> set, T element)
-
findMethodCurrentOrEnclosing
public static java.util.Optional<java.lang.reflect.Method> findMethodCurrentOrEnclosing(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... parameterTypes)Find the firstMethodof 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; nevernullmethodName- the name of the method to find; nevernullor emptyparameterTypes- the types of parameters accepted by the method, if any; nevernull- Returns:
- an
Optionalcontaining the method found; nevernullbut potentially empty if no such method could be found - See Also:
ReflectionSupport.findMethod(Class, String, Class...)
-
findAllContexts
public static java.util.List<org.junit.jupiter.api.extension.ExtensionContext> findAllContexts(org.junit.jupiter.api.extension.ExtensionContext context)
Find all (parent)ExtensionContexts 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; nevernullor empty
-
nullSafeToString
public static java.lang.String nullSafeToString(java.lang.Object object)
-
wrap
public static <T> java.lang.Class<T> wrap(java.lang.Class<T> clazz)
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:
MethodType.wrap()
-
cartesianProduct
public static java.util.List<java.util.List<?>> cartesianProduct(java.util.List<java.util.List<?>> lists)
-
createLocale
public static java.util.Locale createLocale(java.lang.String language, java.lang.String country, java.lang.String variant)
-
createLocale
public static java.util.Locale createLocale(java.lang.String language, java.lang.String country)
-
createLocale
public static java.util.Locale createLocale(java.lang.String language)
-
-