Package net.jqwik.api.arbitraries
Interface TraverseArbitrary.Traverser
- Enclosing interface:
- TraverseArbitrary<T>
public static interface TraverseArbitrary.Traverser
A traverser describes how to travers a given type by providing a hook to
resolve a parameter into an arbitrary and a means to find all relevant
creators (constructors or factory methods) for a type that does not have a suitable default arbitrary.
-
Method Summary
Modifier and TypeMethodDescriptionfindCreators
(TypeUsage targetType) Return all creators (constructors or static factory methods) for a type to traverse.resolveParameter
(TypeUsage parameterType) Create an arbitrary for a creator parameter.
-
Method Details
-
resolveParameter
Create an arbitrary for a creator parameter. Only implement if you do not want to resolve the parameter through its default arbitrary (if there is one)- Parameters:
parameterType
- The typeUsage of the parameter, including annotations- Returns:
- New Arbitrary or
Optional.empty()
-
findCreators
Return all creators (constructors or static factory methods) for a type to traverse.If you return an empty set, the attempt to generate a type will be stopped by throwing an exception.
- Parameters:
targetType
- The target type for which to find creators (factory methods or constructors)- Returns:
- A set of at least one creator.
-