Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
J

jfairy

> 编程语言
Open source

Java fake data generator

742 stars0 likes1 views
WebsiteGitHub

About

Java fake data generator

jFairy by Devskiller

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:

xml

    com.devskiller
    jfairy
    0.9.0

Usage

Creating simple objects

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

System.out.println(person.getFirstName());
// Chloe
System.out.println(person.getLastName());
// Barker
System.out.println(person.getEmail());
// [email protected]
System.out.println(person.getTelephoneNumber());
// 690-950-802
System.out.println(person.getJobTitle());
// Software Developer

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

Creating related objects

java
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(PersonProperties.withCompany(company));
System.out.println(salesman.getFullName());
// Juan Camacho
System.out.println(salesman.getCompanyEmail());
// [email protected]

Supported locales

Locale Language tag
English (default) en
Polish pl
German de
French fr
Spanish es
Swedish sv
Chinese zh
Georgian ka
Italian it
Brazilian Portuguese br
Slovak sk
Turkish tr
Japanese ja
java
Fairy enFairy = Fairy.create();
// Locale.ENGLISH is default
Fairy plFairy = Fairy.create(Locale.forLanguageTag("pl"));
// Polish version
Fairy brFairy = Fairy.create(Locale.forLanguageTag("br"));
// Brazilian version

Unique values

java
UniqueFairy unique = fairy.unique();
Person p1 = unique.person();  // unique by email
Person p2 = unique.person();  // different email than p1
Company c = unique.company(); // unique by name

For custom uniqueness keys:

java
UniqueEnforcer unique = UniqueEnforcer.of(fairy::person, Person::getFullName);
Person p = unique.next();

Thread safety

Fairy objects are not designed for concurrent use by multiple threads. It is recommended to create a separate Fairy instance for each thread.

While some methods might appear safe, the underlying Random implementation can lead to contention and poor performance. Creating dedicated instances ensures both thread safety and optimal execution speed.

JUnit 5 Extension

If you use JUnit 5, check out jfairy-junit-extension — an extension that allows injecting jFairy-generated objects directly into test method parameters.

Building

This project uses Maven and can be built using the provided wrapper:

bash
./mvnw

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaandroidgroovyjavatest-data-generator

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言