From 13ef7ba5923a8c7c9b7e5650199a9357eb1045c9 Mon Sep 17 00:00:00 2001 From: "ah.jo" Date: Wed, 4 Sep 2024 14:59:25 +0900 Subject: [PATCH] Release 1.1.0 snapshot version --- build.gradle.kts | 4 ++-- .../kotlin/FixtureMonkeyExtensions.kt | 8 ++++++++ .../tests/kotlin/SimpleValueJqwikPluginTest.kt | 14 +++++--------- .../navercorp/fixturemonkey/ArbitraryBuilder.java | 8 ++++++++ .../JavaTypeDefaultTypeArbitraryBuilder.java | 11 +++++++++++ .../experimental/ExperimentalArbitraryBuilder.java | 9 --------- 6 files changed, 34 insertions(+), 20 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1c760f931..987cff21a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,8 +6,8 @@ plugins { } allprojects { - group = "com.navercorp.fixturemonkey" - version = "1.1.0-SNAPSHOT" + group = "com.navercorp.fixturemonkey.snapshot" + version = "1.1.0" } subprojects { diff --git a/fixture-monkey-kotlin/src/main/kotlin/com/navercorp/fixturemonkey/kotlin/FixtureMonkeyExtensions.kt b/fixture-monkey-kotlin/src/main/kotlin/com/navercorp/fixturemonkey/kotlin/FixtureMonkeyExtensions.kt index 3b82dc3c4..6f9c5a81f 100644 --- a/fixture-monkey-kotlin/src/main/kotlin/com/navercorp/fixturemonkey/kotlin/FixtureMonkeyExtensions.kt +++ b/fixture-monkey-kotlin/src/main/kotlin/com/navercorp/fixturemonkey/kotlin/FixtureMonkeyExtensions.kt @@ -20,6 +20,8 @@ package com.navercorp.fixturemonkey.kotlin import com.navercorp.fixturemonkey.ArbitraryBuilder import com.navercorp.fixturemonkey.FixtureMonkey +import com.navercorp.fixturemonkey.api.arbitrary.CombinableArbitrary +import com.navercorp.fixturemonkey.api.experimental.TypedPropertySelector import com.navercorp.fixturemonkey.api.instantiator.Instantiator import com.navercorp.fixturemonkey.api.property.PropertySelector import com.navercorp.fixturemonkey.api.type.TypeReference @@ -229,6 +231,12 @@ class KotlinTypeDefaultArbitraryBuilder( ): KotlinTypeDefaultArbitraryBuilder = this.apply { delegate.instantiate(type, instantiator) } + override fun customizeProperty( + propertySelector: TypedPropertySelector, + combinableArbitraryCustomizer: Function, CombinableArbitrary> + ): KotlinTypeDefaultArbitraryBuilder = + this.apply { delegate.customizeProperty(propertySelector, combinableArbitraryCustomizer) } + override fun build(): Arbitrary = delegate.build() override fun sample(): T = delegate.sample() diff --git a/fixture-monkey-tests/kotlin-tests/src/test/kotlin/com/navercorp/fixturemonkey/tests/kotlin/SimpleValueJqwikPluginTest.kt b/fixture-monkey-tests/kotlin-tests/src/test/kotlin/com/navercorp/fixturemonkey/tests/kotlin/SimpleValueJqwikPluginTest.kt index fa0fa0e73..b32d15ace 100644 --- a/fixture-monkey-tests/kotlin-tests/src/test/kotlin/com/navercorp/fixturemonkey/tests/kotlin/SimpleValueJqwikPluginTest.kt +++ b/fixture-monkey-tests/kotlin-tests/src/test/kotlin/com/navercorp/fixturemonkey/tests/kotlin/SimpleValueJqwikPluginTest.kt @@ -60,13 +60,10 @@ class SimpleValueJqwikPluginTest { @RepeatedTest(TEST_COUNT) fun modifyStringLength() { - val sut = FixtureMonkey.builder() - .plugin( - SimpleValueJqwikPlugin() - .minStringLength(2) - .maxStringLength(3) - ) - .build() + val sut = + FixtureMonkey.builder() + .plugin(SimpleValueJqwikPlugin()) + .build() val actual: String = sut.giveMeOne() @@ -142,7 +139,7 @@ class SimpleValueJqwikPluginTest { @RepeatedTest(TEST_COUNT) fun sampleSetObject() { - class SetObject (val integers: Set) + class SetObject(val integers: Set) val sut = FixtureMonkey.builder() .plugin(KotlinPlugin()) @@ -201,5 +198,4 @@ class SimpleValueJqwikPluginTest { then(actual).isBetween(Byte.MIN_VALUE, Byte.MAX_VALUE) } - } diff --git a/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/ArbitraryBuilder.java b/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/ArbitraryBuilder.java index 595ec3804..54a349d1e 100644 --- a/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/ArbitraryBuilder.java +++ b/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/ArbitraryBuilder.java @@ -36,6 +36,8 @@ import net.jqwik.api.Combinators.F3; import net.jqwik.api.Combinators.F4; +import com.navercorp.fixturemonkey.api.arbitrary.CombinableArbitrary; +import com.navercorp.fixturemonkey.api.experimental.TypedPropertySelector; import com.navercorp.fixturemonkey.api.instantiator.Instantiator; import com.navercorp.fixturemonkey.api.property.PropertySelector; import com.navercorp.fixturemonkey.api.type.TypeReference; @@ -554,4 +556,10 @@ ArbitraryBuilder zipWith( ArbitraryBuilder instantiate(Class type, Instantiator instantiator); ArbitraryBuilder instantiate(TypeReference type, Instantiator instantiator); + + @API(since = "1.0.9", status = Status.MAINTAINED) + ArbitraryBuilder customizeProperty( + TypedPropertySelector propertySelector, + Function, CombinableArbitrary> combinableArbitraryCustomizer + ); } diff --git a/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/builder/JavaTypeDefaultTypeArbitraryBuilder.java b/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/builder/JavaTypeDefaultTypeArbitraryBuilder.java index 67a72bec6..444c7260e 100644 --- a/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/builder/JavaTypeDefaultTypeArbitraryBuilder.java +++ b/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/builder/JavaTypeDefaultTypeArbitraryBuilder.java @@ -38,6 +38,8 @@ import com.navercorp.fixturemonkey.ArbitraryBuilder; import com.navercorp.fixturemonkey.JavaTypeArbitraryBuilder; +import com.navercorp.fixturemonkey.api.arbitrary.CombinableArbitrary; +import com.navercorp.fixturemonkey.api.experimental.TypedPropertySelector; import com.navercorp.fixturemonkey.api.instantiator.Instantiator; import com.navercorp.fixturemonkey.api.property.PropertySelector; import com.navercorp.fixturemonkey.api.type.TypeReference; @@ -335,4 +337,13 @@ public JavaTypeArbitraryBuilder instantiate(TypeReference type, Instantiat delegate.instantiate(type, instantiator); return this; } + + @Override + public JavaTypeArbitraryBuilder customizeProperty( + TypedPropertySelector propertySelector, + Function, CombinableArbitrary> combinableArbitraryCustomizer + ) { + delegate.customizeProperty(propertySelector, combinableArbitraryCustomizer); + return this; + } } diff --git a/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/experimental/ExperimentalArbitraryBuilder.java b/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/experimental/ExperimentalArbitraryBuilder.java index 4bda3fd81..0affd99ea 100644 --- a/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/experimental/ExperimentalArbitraryBuilder.java +++ b/fixture-monkey/src/main/java/com/navercorp/fixturemonkey/experimental/ExperimentalArbitraryBuilder.java @@ -18,20 +18,11 @@ package com.navercorp.fixturemonkey.experimental; -import java.util.function.Function; - import org.apiguardian.api.API; import org.apiguardian.api.API.Status; import com.navercorp.fixturemonkey.ArbitraryBuilder; -import com.navercorp.fixturemonkey.api.arbitrary.CombinableArbitrary; -import com.navercorp.fixturemonkey.api.experimental.TypedPropertySelector; @API(since = "0.6.12", status = Status.MAINTAINED) public interface ExperimentalArbitraryBuilder extends ArbitraryBuilder { - @API(since = "1.0.9", status = Status.EXPERIMENTAL) - ArbitraryBuilder customizeProperty( - TypedPropertySelector propertySelector, - Function, CombinableArbitrary> combinableArbitraryCustomizer - ); }