randomgenkt

Initialize instances of any class with generated data.

Лицензия

Лицензия

MIT
Группа

Группа

com.mitteloupe.randomgenkt
Идентификатор

Идентификатор

randomgenkt
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

pom.sha512
Описание

Описание

randomgenkt
Initialize instances of any class with generated data.
Ссылка на сайт

Ссылка на сайт

https://github.com/EranBoudjnah/RandomGenKt.git
Система контроля версий

Система контроля версий

https://github.com/EranBoudjnah/RandomGenKt.git

Скачать randomgenkt

Зависимости

runtime (3)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.4.20
org.jetbrains.kotlin : kotlin-reflect jar 1.4.21
com.implimentz » unsafe jar 0.0.6

test (5)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13.2
org.hamcrest : hamcrest-core jar 2.2
org.mockito : mockito-core jar 3.9.0
org.mockito : mockito-inline jar 3.9.0
com.nhaarman.mockitokotlin2 : mockito-kotlin jar 2.2.0

Модули Проекта

Данный проект не имеет модулей.

RandomGenKt

Initialize instances of any class with generated data.

Version - RandomGenKt Version - DataSource Build Status License

Example

This is a Kotlin port of the Java library designed to generate random instances of any class.

This is great for demoing your app with interesting content, manually testing it with varying data, and even populating it with smart, random generated data in production.

Install

In your build.gradle, add the following:

dependencies {
    implementation("com.mitteloupe.randomgenkt:randomgenkt:1.0.1")
}

To include the default data generators, also include

dependencies {
    implementation("com.mitteloupe.randomgenkt:randomgenkt.datasource:1.0.1")
}

Usage

Kotlin

val randomGen = RandomGen.Builder<ObjectClass>()
	.ofClass<ObjectClass>()
	.withField("id")
	.returningSequentialInteger()
	.withField("uuid")
	.returningUuid()
	.build()

Java

RandomGen<ObjectClass> randomGen = new RandomGen.Builder<ObjectClass>()
	.ofClass(ObjectClass.class)
	.withField("id")
	.returningSequentialInteger()
	.withField("uuid")
	.returningUuid()
	.build();

This will create a RandomGen instance producing ObjectClass instances with sequential IDs and random UUIDs.

To use the newly generated RandomGen, simply call:

Kotlin

val instance = randomGen.generate()

Java

ObjectClass instance = randomGen.generate();

What's New?

The Kotlin version adds the following:

  • Support for fields with lazy init
  • Lambdas
  • ofClass<Type>() instead of ofClass(Type::class.java)

Created by

Eran Boudjnah

License

MIT © Eran Boudjnah

Версии библиотеки

Версия
1.0.1