DEV Community


Posted on • Originally published at

Using EasyRandom with Spring Framework

Tired of creating objects in tests. Try using EasyRandom library. Here is how easily you can add it to a Spring Java project

Step 1: Add gradle/maven dependency

Step 2: Declare it in test

Step 3: Use it to generate random data objects

Step 4: 😍


Random initial seed

In the default setup, EasyRandom uses a default seed value to generate randam data.
Although it is quite simple to initiate EasyRandom with a random seed.

Enforcing javax.validation rules:

If an object is using javax.validation then there is an extension which enforces those rules when generating random objects.



Top comments (0)