Skip to content

Commit

Permalink
Release 1.1.0 snapshot version
Browse files Browse the repository at this point in the history
  • Loading branch information
seongahjo committed Sep 4, 2024
1 parent d3831dc commit 13ef7ba
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 20 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -229,6 +231,12 @@ class KotlinTypeDefaultArbitraryBuilder<T>(
): KotlinTypeDefaultArbitraryBuilder<T> =
this.apply { delegate.instantiate(type, instantiator) }

override fun <U : Any?> customizeProperty(
propertySelector: TypedPropertySelector<U>,
combinableArbitraryCustomizer: Function<CombinableArbitrary<out U>, CombinableArbitrary<out U>>
): KotlinTypeDefaultArbitraryBuilder<T> =
this.apply { delegate.customizeProperty(propertySelector, combinableArbitraryCustomizer) }

override fun build(): Arbitrary<T> = delegate.build()

override fun sample(): T = delegate.sample()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -142,7 +139,7 @@ class SimpleValueJqwikPluginTest {

@RepeatedTest(TEST_COUNT)
fun sampleSetObject() {
class SetObject (val integers: Set<Integer>)
class SetObject(val integers: Set<Integer>)

val sut = FixtureMonkey.builder()
.plugin(KotlinPlugin())
Expand Down Expand Up @@ -201,5 +198,4 @@ class SimpleValueJqwikPluginTest {

then(actual).isBetween(Byte.MIN_VALUE, Byte.MAX_VALUE)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -554,4 +556,10 @@ <R> ArbitraryBuilder<R> zipWith(
ArbitraryBuilder<T> instantiate(Class<?> type, Instantiator instantiator);

ArbitraryBuilder<T> instantiate(TypeReference<?> type, Instantiator instantiator);

@API(since = "1.0.9", status = Status.MAINTAINED)
<U> ArbitraryBuilder<T> customizeProperty(
TypedPropertySelector<U> propertySelector,
Function<CombinableArbitrary<? extends U>, CombinableArbitrary<? extends U>> combinableArbitraryCustomizer
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -335,4 +337,13 @@ public JavaTypeArbitraryBuilder<T> instantiate(TypeReference<?> type, Instantiat
delegate.instantiate(type, instantiator);
return this;
}

@Override
public <U> JavaTypeArbitraryBuilder<T> customizeProperty(
TypedPropertySelector<U> propertySelector,
Function<CombinableArbitrary<? extends U>, CombinableArbitrary<? extends U>> combinableArbitraryCustomizer
) {
delegate.customizeProperty(propertySelector, combinableArbitraryCustomizer);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> extends ArbitraryBuilder<T> {
@API(since = "1.0.9", status = Status.EXPERIMENTAL)
<U> ArbitraryBuilder<T> customizeProperty(
TypedPropertySelector<U> propertySelector,
Function<CombinableArbitrary<? extends U>, CombinableArbitrary<? extends U>> combinableArbitraryCustomizer
);
}

0 comments on commit 13ef7ba

Please sign in to comment.