Class ObjectRandomizers

java.lang.Object
io.github.cjstehno.testthings.rando.ObjectRandomizers

public final class ObjectRandomizers extends Object
Randomizers useful for generating more complex objects using the injector framework.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <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).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ObjectRandomizers

      public ObjectRandomizers()
  • Method Details

    • randomized

      public 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).
      Type Parameters:
      O - the type of the randomizer
      Parameters:
      instanceProvider - provides an instance of the target object
      injector - the injection configuration
      Returns:
      the randomizer
    • randomized

      public 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).
      Type Parameters:
      O - the type of the randomizer
      Parameters:
      instance - the instance of the target object
      injector - the injection configuration
      Returns:
      the randomizer
    • randomized

      public static <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).
      Type Parameters:
      O - the type of the randomizer
      Parameters:
      instanceProvider - provides an instance of the target object
      injections - the injection configuration
      Returns:
      the randomizer
    • randomized

      public 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).
      Type Parameters:
      O - the type of the randomizer
      Parameters:
      instance - the instance of the target object
      injections - 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 object
      config - the injection configuration
      Returns:
      the randomizer
    • randomized

      public 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).
      Type Parameters:
      O - the type of the randomizer
      Parameters:
      instance - the instance of the target object
      config - the injection configuration
      Returns:
      the randomizer