Skip to content

CodyEngel/fakek

Repository files navigation

FakeK

Bintray CircleCI Codecov

FakeK is a port of Java-Faker for Kotlin. This is in very early development and at this time will act as a wrapper around Java-Faker for certain fake instances. There is no intention to bring all of the fakes and instead we will be intentional with what instances to add and which ones to exclude.

How To Use FakeK

FakeK provides a single function, fakek, as an entry point to start accessing all available fakes. The available fakes are made available by FakeContext which is created for each fakek function invocation.

data class Person(val firstName: String, val middleName: String, val lastName: String)

fun main() {
    val fakePerson: Person = fakek {
        Person(firstName = fakeName.firstName, middleName = fakeName.middleName, lastName = fakeName.lastName)
    }
    println(fakePerson)
}

Dependencies

FakeK stable releases are available through jcenter() and can be added with the following gradle snippets:

// Gradle - Groovy
implementation "dev.fakek:fakek:<VERSION>"

// Gradle - Kotlin
implementation("dev.fakek:fakek:<VERSION>")

Note that the above examples uses implementation which will add FakeK to your production binaries. If you only need these for unit testing then consider using testImplementation instead.