Class RandomValueFactory

java.lang.Object
com.telenav.kivakit.internal.testing.RandomValueFactory
All Implemented Interfaces:
CastTrait, RandomNumeric

public class RandomValueFactory extends Object implements RandomNumeric
Utility class for tests used to create random values. The UnitTest class has a variety of methods for random testing that use this class. Projects can subclass this to provide additional random values relevant to the project.

Seeding

The seed used for random values can be set with seed(long). KivaKit tests will emit a seed value when a test fails. This value can be fed to seed(long) to reproduce the failure.

Values

Values of the given types can be randomly produced:

  • Characters
  • Strings
  • Booleans
  • Bytes
  • Confidence
  • Count
  • Double
  • Identifier
  • Ints
  • Longs
  • Shorts
  • Unsigned Doubles
  • Unsigned Ints
  • Unsigned Longs
Author:
jonathanl (shibo)
  • Field Details

    • random

      protected Random random
      Random number generator
  • Constructor Details

    • RandomValueFactory

      public RandomValueFactory(long seed)
    • RandomValueFactory

      public RandomValueFactory()
  • Method Details