I just start to implement a webservice for my new own project and i need to create a business layer for the front-end team to develop clients in parallel! the fastest way is to generate fake data!
- annotate your model:
public static class Person {
@Username(containsNumber = true)
private String username;
@Email(provider = Email.Provider.Hotmail)
private String email;
@Name(gender = Name.Gender.Male)
private String name;
@Phone
private String phone;
@Password
private String password;
@Number(negative = true)
private int num;
@Address
private String address;
@Text(equalOrShorterThan = 30)
private String text;
@City
private String city;
@Country
private String country;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
- generate fake data:
Person p = FakeInstance
.get()
.createAndFill(Person.class, 1);
Example output for two fake instance generated by Fake Instance:
Person #1{
username='Babushka797'
, email='Wilma@hotmail.com'
, name='Arvin'
, phone='754-3010'
, password='ocski1isiwxh8xod'
, num=-2
, num3=66.0
, address='264 Meadow Lane'
, text='On assistance he cultivated considered frequently. Person how having tended direct own day man. Saw sufficient indulgence one own you inquietude sympathize.'
, city='Paris'
, country='New Caledonia'
}
Person #2{
username='ragingpuma172'
, email='Hermione@hotmail.com'
, name='Oliver'
, phone='754-3010'
, password='3cey1qg8td2b827a'
, num=-4
, num3=41.0
, address='3347 Stratford Drive'
, text='On assistance he cultivated considered frequently. Person how having tended direct own day man. Saw sufficient indulgence one own you inquietude sympathize.'
, city='Rio de Janeiro'
, country='Guadeloupe'
}