Any library to populate sample data in a Java object

I have a java object (pojo bean) that contains some fields and another java object. Is there any library in java that I can use to populate this object?

I want to pass a new object to this library, and it should return me an object with some random data filled inside it.

Lets say if I have an employee and a department object. An employee has a name (string), identifier (int), and department property. A department has an id (int) property and a name (string).

I want this employee object to be populated with some sample data, such as "abc" for the name, 32 for id, etc.

Is this possible, or do I need to write my own code? Any pointer will help me.

+4
source share
1 answer

My mistake, the question has already been asked - Automatically fill primitive properties with random data? . He has a solution.

Even if someone knows the best solution, feel free to post it.

+3
source

All Articles