Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.42 KB

README.adoc

File metadata and controls

42 lines (34 loc) · 1.42 KB

Java Faker integration

build.gradle.kts
// Add for Java Faker integration
testImplementation("com.appmattus.fixture:fixture-javafaker:<latest-version>")

The Java Faker library generates fake data, useful if you need to generate objects with pretty data.

Including the fixture-javafaker dependency in your project adds a javaFakerStrategy which uses Java Faker to populate named properties such as name, city and phoneNumber. A full list of supported properties and how they map to Java Faker can be found in JavaFakerConfiguration.

val fixture = kotlinFixture {
    javaFakerStrategy()
}

data class Person(val name: String, val age: Long)

println(fixture<Person>()) // Person(name=Keneth Bartoletti, age=54)

Additionally, the javaFakerStrategy function allows you to override faker settings such as locale. The available options can be found in JavaFakerConfigurationBuilder.