How to add dummy data to your java object


When you are unit testing, it is sometimes necessary to supplement an object with dummy data. Unfortunately, to fill a large object manually, it crawls a lot of time and work. Fortunately, there is a tool that saves us the time and work!

At, you can find a java library that fills an object with dummy data by typing one line of code.

If you use Maven, you can add the following dependency:



In this example, we want to add dummy data for an object User.

public class User {

    private Long id;
    private String firstName;
    private String lastName;
    private String email;

    //getters & setters...

Now, to fill this object, type the following code:

User user = new DummyCreator().create(User.class);

It’s easy as that! Enjoy! 😀

1 comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tag Cloud