Instancio: Test Data Generator for Java (Part 2)

In part 1, we introduced Instancio and how it can be used to automate data setup in unit tests. To recap, Instancio is a library that automates data setup in unit tests, with the goal of reducing manual data setup. More specifically, it accepts a class (or a "type token") as an argument and returns a fully-populated instance of the class. Sticking to our Person class for all our examples, this can be done as follows:

Java
 
Person person = Instancio.create(Person.class);

Map<UUID, Person> person = Instancio.create(new TypeToken<Map<UUID, Person>>() {});


CategoriesUncategorized