close
The Wayback Machine - https://web.archive.org/web/20200914084422/https://github.com/makbn/fake_instance
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

Readme.md

Fake Instance Generator

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!

How to use

  1. 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;
        }
        
    }
  1. 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'
}

About

Java library for generating fake model

Topics

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.