Giter VIP home page Giter VIP logo

faker's Introduction

faker

version CI

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<Person> 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:

List<Address> addresses = RandomAddress.get().listOf(20);

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.

Maven

Add the following to your pom.xml:

<repositories>
    <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>http://repo.maven.apache.org/maven2</url>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>

...

<dependency>
    <groupId>com.arakelian</groupId>
    <artifactId>faker</artifactId>
    <version>4.0.1</version>
    <scope>test</scope>
</dependency>

Gradle

Add the following to your build.gradle:

repositories {
  mavenCentral()
}

dependencies {
  testCompile 'com.arakelian:faker:4.0.1'
}

Licence

Apache Version 2.0

faker's People

Contributors

arakelian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

faker's Issues

Add More Random Address Data

This seems to be specific to generating addresses in San Fransisco, California.

Add extra cities, states and countries to the generator.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.