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
.