Skip to content

Commit

Permalink
Use KotlinArbitraryBuilder in kotest (#1122)
Browse files Browse the repository at this point in the history
Signed-off-by: Taeik Lim <[email protected]>
  • Loading branch information
acktsap authored Dec 16, 2024
1 parent 959350f commit d785ae2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import com.navercorp.fixturemonkey.FixtureMonkey
import com.navercorp.fixturemonkey.api.property.PropertySelector
import com.navercorp.fixturemonkey.api.type.TypeReference
import com.navercorp.fixturemonkey.api.type.Types
import com.navercorp.fixturemonkey.kotlin.KotlinTypeDefaultArbitraryBuilder
import com.navercorp.fixturemonkey.kotlin.giveMeBuilder
import com.navercorp.fixturemonkey.kotlin.giveMeKotlinBuilder
import com.navercorp.fixturemonkey.kotlin.giveMeOne
import com.navercorp.fixturemonkey.kotlin.propertyExpressionGenerator
import io.kotest.property.Arb
Expand Down Expand Up @@ -67,9 +69,9 @@ inline fun <reified T> FixtureMonkey.giveMeArb(): Arb<T> {
}
}

inline fun <reified T> FixtureMonkey.giveMeArb(crossinline applyBuilder: ArbitraryBuilder<T>.() -> ArbitraryBuilder<T>): Arb<T> =
inline fun <reified T> FixtureMonkey.giveMeArb(crossinline applyBuilder: KotlinTypeDefaultArbitraryBuilder<T>.() -> ArbitraryBuilder<T>): Arb<T> =
arbitrary {
applyBuilder.invoke(this@giveMeArb.giveMeBuilder()).sample()
applyBuilder.invoke(this@giveMeArb.giveMeKotlinBuilder()).sample()
}

fun <T : Any?> ArbitraryBuilder<T>.setArb(expression: String, arb: Arb<Any>): ArbitraryBuilder<T> = this.set(
Expand Down

0 comments on commit d785ae2

Please sign in to comment.