Scala Fake Data Generator. This repository includes Scala implementation for Golang Faker.
Supported Scala versions
- Scala 2.11
- Scala 2.12
This library is available at Maven Central Repository. To use the latest stable version, append the
following to your build.sbt
and replace LATEST_VERSION
with the latest version published, which
should be
libraryDependencies += "com.github.stevenchen3" %% "scala-faker" % "LATEST_VERSION"
Check scalastyle, run tests and generate coverage report across all supported Scala versions:
sbt +scalastyle +scalafixcheck +coverage +test +coverageReport
Make sure export GPG_TTY=$(tty)
(this fixes gpg: signing failed: Inappropriate ioctl for device
error, checkout here to see why) is
appended to ~/.bashrc
or has been loaded to current shell.
source ~/.bashrc
sbt +publishLocalSigned
import io.alphash.faker._
val number = Phone().phoneNumber()
println(s"$number") // output some phone number like, "+1 (202) 737-6022"
val name = Person().name
println(s"$name") // e.g., "Blanca Spencer"
val price = Price().amountWithCurrency
println(s"$price") // e.g., "CAD 42545.1"
val ip = Internet().ipv4
println(s"$ip") // e.g., "89.51.74.211"
...
It currently supports the following fakers:
Datetime :
- Datetime
- Time
Geolocation :
- Latitude and Longitude
Internet :
- Mac address
- Domain name
- URL
- Username
- IP Address (IPv4, IPv6 )
- Password
Lorem :
- Word
- Sentence
- Paragraph
Payment :
- Credit Card Type (VISA, MASTERCARD, AMERICAN EXPRESS, DISCOVER, JCB, DINERS CLUB)
- Credit Card Number
Person :
- Title male
- Title female
- First name
- First name male
- First name female
- Last name
- Name with title
- Name (first last)
Phone :
- Phone number
- Country code (US and Singapore)
- Area code
- Toll free phone number
- E164PhoneNumber
Price :
- Currency
- Amount