I need some test data to be displayed in my PrimeFaces Template App.
A good library to generate fake data is: Java Faker.
Add Java Faker to dependencies in Maven:
<dependency> <groupId>com.github.javafaker</groupId> <artifactId>javafaker</artifactId> <version>1.0.2</version> </dependency>
For Example I want to have a Person with following fields:
private String firstName; private String lastName; private Date dayOfBirth; private String phoneNumber; private String streetName; private String streetAddressNumber; private String zipCode; private String city; private String state;
A Person can be generated with fake data from Java Faker like this:
String firstName = faker.name().firstName(); String lastName = faker.name().lastName(); Date dayOfBirth = faker.date().birthday(); String phoneNumber = faker.phoneNumber().phoneNumber(); String streetName = faker.address().streetName(); String streetAddressNumber = faker.address().streetAddressNumber(); String zipCode = faker.address().zipCode(); String city = faker.address().city(); String state = faker.address().state(); Person person = new Person(firstName, lastName, dayOfBirth, phoneNumber, streetName, streetAddressNumber, zipCode, city, state);