Skip to content

Latest commit

 

History

History
58 lines (50 loc) · 1.58 KB

README.md

File metadata and controls

58 lines (50 loc) · 1.58 KB

Build Status

Codacy Badge

Kovfefe

Kotlin library for genrating data types.

Motivation

Many times writing tests requires generating data types which can be tedious. This library aims at making generating data for tests easier.

Examaple

data class Movie(
    val overview: String,
    val originalLanguage: String,
    val originalTitle: String,
    val video: Boolean,
    val title: String,
    val genreIds: List<Int>,
    val posterPath: String,
    val backdropPath: String,
    val releaseDate: String,
    val popularity: Double,
    val voteAverage: Double,
    val id: Int,
    val adult: Boolean,
    val voteCount: Int
)

We have the generate Movie data type with fixed 'id' and 'title' and any valid values for the rest of the fields

Before
val movie = Movie(
    overview = "",
    originalLanguage = "",
    originalTitle = "",
    video = true,
    title = "Avengers: Infinity War",
    genreIds = listOf(),
    posterPath = "",
    backdropPath = "",
    releaseDate = "",
    popularity = 9.8,
    voteAverage = 9.5,
    id = 42,
    adult = false,
    voteCount = 10_000
)
After
val movie = generate<Movie>().copy(id = 42, title = "Avengers: Infinity War")