Class ObjectRandomizers
java.lang.Object
io.github.cjstehno.testthings.rando.ObjectRandomizers
Randomizers useful for generating more complex objects using the injector framework.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <O> Randomizer<O>randomized(Supplier<O> instanceProvider, Injections injections) Creates a randomizer to generate an object based on the instance returned by the provider and using the injections to populate the instance (by injecting randomizers).static <O> Randomizer<O>randomized(Supplier<O> instanceProvider, Injector injector) Creates a randomizer to generate an object based on the instance returned by the provider and using the injector to populate the instance (by injecting randomizers).static <O> Randomizer<O>randomized(Supplier<O> instanceProvider, Consumer<Injections> config) Creates a randomizer to generate an object based on the instance returned by the provider and using the injections to populate the instance (by injecting randomizers).static <O> Randomizer<O>randomized(O instance, Injections injections) Creates a randomizer to generate an object based on the instance using the injections to populate the instance (by injecting randomizers).static <O> Randomizer<O>randomized(O instance, Injector injector) Creates a randomizer to generate an object based on the instance using the injector to populate the instance (by injecting randomizers).static <O> Randomizer<O>randomized(O instance, Consumer<Injections> config) Creates a randomizer to generate an object based on the instance using the injections to populate the instance (by injecting randomizers).
-
Constructor Details
-
ObjectRandomizers
public ObjectRandomizers()
-
-
Method Details
-
randomized
Creates a randomizer to generate an object based on the instance returned by the provider and using the injector to populate the instance (by injecting randomizers).- Type Parameters:
O- the type of the randomizer- Parameters:
instanceProvider- provides an instance of the target objectinjector- the injection configuration- Returns:
- the randomizer
-
randomized
Creates a randomizer to generate an object based on the instance using the injector to populate the instance (by injecting randomizers).- Type Parameters:
O- the type of the randomizer- Parameters:
instance- the instance of the target objectinjector- the injection configuration- Returns:
- the randomizer
-
randomized
Creates a randomizer to generate an object based on the instance returned by the provider and using the injections to populate the instance (by injecting randomizers).- Type Parameters:
O- the type of the randomizer- Parameters:
instanceProvider- provides an instance of the target objectinjections- the injection configuration- Returns:
- the randomizer
-
randomized
Creates a randomizer to generate an object based on the instance using the injections to populate the instance (by injecting randomizers).- Type Parameters:
O- the type of the randomizer- Parameters:
instance- the instance of the target objectinjections- the injection configuration- Returns:
- the randomizer
-
randomized
public static <O> Randomizer<O> randomized(Supplier<O> instanceProvider, Consumer<Injections> config) Creates a randomizer to generate an object based on the instance returned by the provider and using the injections to populate the instance (by injecting randomizers).- Type Parameters:
O- the type of the randomizer- Parameters:
instanceProvider- provides an instance of the target objectconfig- the injection configuration- Returns:
- the randomizer
-
randomized
Creates a randomizer to generate an object based on the instance using the injections to populate the instance (by injecting randomizers).- Type Parameters:
O- the type of the randomizer- Parameters:
instance- the instance of the target objectconfig- the injection configuration- Returns:
- the randomizer
-