https://github.com/arakelian/faker
A Java library for generating fake data such as names, addresses, and phone numbers.
https://github.com/arakelian/faker
data fake fake-content fake-data faker java java-8 mocking mocks test
Last synced: 6 months ago
JSON representation
A Java library for generating fake data such as names, addresses, and phone numbers.
- Host: GitHub
- URL: https://github.com/arakelian/faker
- Owner: arakelian
- License: apache-2.0
- Created: 2017-12-04T02:47:40.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-04-24T04:06:47.000Z (about 2 years ago)
- Last Synced: 2024-05-01T20:43:46.065Z (about 1 year ago)
- Topics: data, fake, fake-content, fake-data, faker, java, java-8, mocking, mocks, test
- Language: Java
- Size: 1.23 MB
- Stars: 23
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# faker
[](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.arakelian%22%20AND%20a%3A%22faker%22)
[](https://github.com/arakelian/faker/actions/workflows/ci.yml)Faker is library for generating high-quality fake data, such as names, addresses and phone numbers.
Faker is still under development, and will evolved in the coming months.Using Faker is very easy.
## Requirements
* Versions < 4.0.0 require Java 8+
* Version 4+ require Java 11+## Generating People
Let's generate a random person.
```
Person person = RandomPerson.get().next()
```If we want a list of 20 random people, we would call:
```
List people = RandomPerson.get().listOf(20);
```If you use Jackson to serialize a person, you'll see something like this:
```
{
"firstName" : "PAM",
"lastName" : "GALLINGER",
"title" : "Carpet, Floor, and Tile Installer",
"gender" : "FEMALE",
"birthdate" : "1987-07-13T22:49:34.743000000Z",
"age" : 30
}
```## Generating Addresses
Let's generate a random address.
```
Address address = RandomAddress.get().next()
```If we want a list of 20 random addresses, we would call:
```
addresses = RandomAddress.get().listOf(20);
List
```If you use Jackson to serialize an address, you'll see something like this:
```
{
"street" : "60 ENGLISH ST",
"city" : "SAN FRANCISCO",
"state" : "CA",
"postalCode" : "94105"
}
```## Installation
The library is available on [Maven Central](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.arakelian%22%20AND%20a%3A%22faker%22).
### Maven
Add the following to your `pom.xml`:
```xml
central
Central Repository
http://repo.maven.apache.org/maven2
true
...
com.arakelian
faker
4.0.1
test```
### Gradle
Add the following to your `build.gradle`:
```groovy
repositories {
mavenCentral()
}dependencies {
testCompile 'com.arakelian:faker:4.0.1'
}
```## Licence
Apache Version 2.0