View on GitHub

jFairy

Java fake data generator

download .ZIP download .TGZ

jFairy

Build Maven Central Javadocs

Java fake data generator. According to Wikipedia:

Fairyland, in folklore, is the fabulous land or abode of fairies or fays.

Installation

Add the following dependency to your pom.xml:

<dependency>
    <groupId>com.devskiller</groupId>
    <artifactId>jfairy</artifactId>
    <version>x.y.z</version>
</dependency>

Usage

Creating simple objects:

Fairy fairy = Fairy.create();
Person person = fairy.person();

System.out.println(person.getFullName());        // Chloe Barker
System.out.println(person.getEmail());           // barker@yahoo.com
System.out.println(person.getTelephoneNumber()); // 690-950-802
System.out.println(person.getJobTitle());        // Software Developer

Person adultMale = fairy.person(male(), minAge(21));
System.out.println(adultMale.isMale());          // true
System.out.println(adultMale.getDateOfBirth());  // at least 21 years earlier

Creating related objects:

Fairy fairy = Fairy.create();
Company company = fairy.company();
System.out.println(company.getName());           // Robuten Associates
System.out.println(company.getUrl());            // http://www.robuteniaassociates.com

Person salesman = fairy.person(withCompany(company));
System.out.println(salesman.getFullName());      // Juan Camacho
System.out.println(salesman.getCompanyEmail());  // juan.camacho@robuteniaassociates.com

Supported locales

🇵🇱 🇬🇧 🇧🇷 🇨🇳 🇫🇷 🇬🇪

🇩🇪 🇮🇹 🇸🇰 🇪🇸 🇸🇪 🇹🇷

Fairy plFairy = Fairy.create(Locale.forLanguageTag("pl"));
Fairy brFairy = Fairy.create(Locale.forLanguageTag("br"));