KFixture

KFixture is a wrapper around JFixture providing a mode Kotlin friendly interface

License

License

GroupId

GroupId

com.flextrade.jfixture
ArtifactId

ArtifactId

kfixture
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

KFixture
KFixture is a wrapper around JFixture providing a mode Kotlin friendly interface
Project URL

Project URL

https://github.com/FlexTradeUKLtd/kfixture
Source Code Management

Source Code Management

https://github.com/FlexTradeUKLtd/kfixture.git

Download kfixture

How to add to project

<!-- https://jarcasting.com/artifacts/com.flextrade.jfixture/kfixture/ -->
<dependency>
    <groupId>com.flextrade.jfixture</groupId>
    <artifactId>kfixture</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.flextrade.jfixture/kfixture/
implementation 'com.flextrade.jfixture:kfixture:0.2.0'
// https://jarcasting.com/artifacts/com.flextrade.jfixture/kfixture/
implementation ("com.flextrade.jfixture:kfixture:0.2.0")
'com.flextrade.jfixture:kfixture:jar:0.2.0'
<dependency org="com.flextrade.jfixture" name="kfixture" rev="0.2.0">
  <artifact name="kfixture" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.flextrade.jfixture', module='kfixture', version='0.2.0')
)
libraryDependencies += "com.flextrade.jfixture" % "kfixture" % "0.2.0"
[com.flextrade.jfixture/kfixture "0.2.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.3.21
com.flextrade.jfixture : jfixture jar 2.7.2

test (4)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.4.0
org.junit.jupiter : junit-jupiter-engine jar 5.4.0
org.mockito : mockito-core jar 2.13.0
com.nhaarman.mockitokotlin2 : mockito-kotlin jar 2.1.0

Project Modules

There are no modules declared in this project.

KFixture

KFixture is a Kotlin wrapper around JFixture.

Build Status

Usage

Import it into maven as so:

<dependency>
	<groupId>com.flextrade.jfixture</groupId>
	<artifactId>kfixture</artifactId>
	<version>1.0.0</version>
	<scope>test</scope>
</dependency>

Create an instance, and invoke it to create fixtured values:

val kFixture = KFixture()

val integer = kFixture<Int>()
val myObject: SomeObject = kFixture()

Numerical Ranges

To create a range for integers, call .intRange(..). However, the upper limit is exclusive. The example below creates an integer fixture between 0 and 4:

val integer = kFixture.intRange(0..5)

Customisation

To customise your KFixture, just pass a body as a parameter:

val kFixture = KFixture {
    circularDependencyBehaviour().omitSpecimen()
}

Ignoring default arguments on constructors

val kFixture = KFixture {
    add(IgnoreDefaultArgsConstructorCustomisation())
}

To fixture classes where every argument has a default value, use this customisation. This will apply to all fixtures generated using this instance.

com.flextrade.jfixture

FlexTrade UK Ltd

Versions

Version
0.2.0
0.1.0