This library is a modern port of java-faker, built on Java 8, with up to date libraries and several newly added Fake Generators.
This library generates fake data, similar to other fake data generators, such as:
- Ruby's faker gem
- Perl's Data::Faker library
- Python faker package
- PHP faker library
- Javascript Faker.js library
It's useful when you're developing a new project and need some pretty data for showcase.
In the pom.xml, add the following fragment to the dependencies
section:
<dependency>
<groupId>net.datafaker</groupId>
<artifactId>datafaker</artifactId>
<version>1.2.0</version>
</dependency>
For Gradle users, add the following to your build.gradle file.
dependencies {
implementation 'net.datafaker:datafaker:1.2.0'
}
You can also use the snapshot version (1.3.0-SNAPSHOT
), which automatically gets published
after every push to the master branch of this repository.
In your Java code:
Faker faker = new Faker();
String name = faker.name().fullName(); // Miss Samanta Schmidt
String firstName = faker.name().firstName(); // Emory
String lastName = faker.name().lastName(); // Barton
String streetAddress = faker.address().streetAddress(); // 60018 Sawayn Brooks Suite 449
Or in your Kotlin code:
val faker = Faker()
val name = faker.name().fullName() // Miss Samanta Schmidt
val firstName = faker.name().firstName() // Emory
val lastName = faker.name().lastName() // Barton
val streetAddress = faker.address().streetAddress() // 60018 Sawayn Brooks Suite 449
https://www.datafaker.net/documentation/providers/
See CONTRIBUTING.md
- Address
- Ancient
- Animal
- App
- Appliance
- Aqua Teen Hunger Force
- Artist
- Avatar
- Aviation
- Babylon5
- Back To The Future
- Barcode
- Basketball
- Beer
- Bojack Horseman
- Book
- Bool
- Bossa Nova
- Breaking Bad
- Business
- CNPJ Brazilian National Registry of Legal Entities
- CPF Brazilian individual taxpayer registry identification
- Cat
- ChuckNorris
- Code
- Coin
- Color
- Commerce
- Company
- Crypto
- DateAndTime
- Demographic
- Dessert
- Disease
- Dog
- Domain
- DragonBall
- Dune
- Durations
- Educator
- EnglandFootBall
- Esports
- File
- Finance
- Food
- Formula 1 (:racing_car:)
- Friends
- FunnyName
- GameOfThrones
- Gender
- Hacker
- HarryPotter
- Heartstone
- Hipster
- HitchhikersGuideToTheGalaxy
- Hobbit
- HowIMetYourMother
- IdNumber
- Internet
- Job
- Kaamelott
- LeagueOfLegends
- Lebowski
- LordOfTheRings
- Lorem
- Matz
- Minecraft
- Mood
- Mountains
- Music
- Name
- Nation
- Nigeria
- Number
- Options
- Overwatch
- Passport
- PhoneNumber
- Photography
- Pokemon
- Princess Bride
- Relationship Terms
- Resident Evil
- RickAndMorty
- Robin
- RockBand
- RuPaul's Drag Race
- Shakespeare
- Sip
- SlackEmoji
- Space
- StarCraft
- StarTrek
- Stock
- Superhero
- Team
- Touhou
- TwinPeaks
- University
- Vehicle
- Weather
- Witcher
- Yoda
- Zelda
Faker faker = new Faker(new Locale("YOUR_LOCALE"));
For example:
new Faker(new Locale("en-us")).address().zipCodeByState("CA"));
- ar
- bg
- ca
- ca-CAT
- cs
- da-DK
- de
- de-AT
- de-CH
- en
- en-AU
- en-au-ocker
- en-BORK
- en-CA
- en-GB
- en-IND
- en-MS
- en-NEP
- en-NG
- en-NZ
- en-PAK
- en-SG
- en-UG
- en-US
- en-ZA
- es
- es-MX
- fa
- fi-FI
- fr
- he
- hu
- in-ID
- it
- ja
- ko
- nb-NO
- nl
- pl
- pt
- pt-BR
- ru
- sk
- sv
- sv-SE
- tr
- uk
- vi
- zh-CN
- zh-TW
Copyright (c) 2022 DataFaker.net See the LICENSE file for license rights and limitations.