Skip to content

Tutorial 9: SimpleRandomGenerator

Kumar Rohit edited this page Oct 3, 2015 · 1 revision

Why?

When writing tests we spend a lot of time creating test models, even when writing unit tests. So to reduce the efforts we have SimpleRandomGenerator.

Generating Random Models

Similar to random-JPA, we have a factory to which we can configure generator i.e. RandomClassGenerator & RandomFieldGenerator

final SimpleRandomGenerator simpleRandomGenerator = SimpleRandomGeneratorFactory
                .newInstance()
                .with(RandomClassGenerators ... )
                .with(RandomFieldGenerators ... )
                .create();

final Person randomPerson = simpleRandomGenerator.getRandom(Person.class);
Clone this wiki locally