You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting a constraint for a String, the arbitrary returned by the JqwikJavaArbitraryResolver will never generate an empty string, although the constraint may allow it.
With the following class, the string field will never get a string with length = 0, although I would expect it
Given type class com.gilpereda.examples.FixtureMonkeyBugTest$Example could not be generated. Check the ArbitraryIntrospector used or the APIs used in the ArbitraryBuilder.
java.lang.IllegalArgumentException: Given type class com.gilpereda.examples.FixtureMonkeyBugTest$Example could not be generated. Check the ArbitraryIntrospector used or the APIs used in the ArbitraryBuilder.
at com.navercorp.fixturemonkey.resolver.ResolvedCombinableArbitrary.combined(ResolvedCombinableArbitrary.java:89)
at com.navercorp.fixturemonkey.builder.DefaultArbitraryBuilder.sample(DefaultArbitraryBuilder.java:486)
at com.navercorp.fixturemonkey.FixtureMonkey.lambda$giveMe$3(FixtureMonkey.java:163)
at java.base/java.util.stream.StreamSpliterators$InfiniteSupplyingSpliterator$OfRef.tryAdvance(StreamSpliterators.java:1367)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at com.navercorp.fixturemonkey.FixtureMonkey.giveMe(FixtureMonkey.java:171)
at com.navercorp.fixturemonkey.FixtureMonkey.giveMeOne(FixtureMonkey.java:179)
at com.gilpereda.examples.FixtureMonkeyBugTest.should generate an empty string(FixtureMonkeyBugTest.kt:32)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: com.navercorp.fixturemonkey.api.exception.RetryableFilterMissException: net.jqwik.api.TooManyFilterMissesException: Filtering [net.jqwik.engine.properties.arbitraries.randomized.ContainerGenerator@1abebef3] missed more than 10000 times.
at com.navercorp.fixturemonkey.api.arbitrary.FilteredCombinableArbitrary.newRetryableFilterMissException(FilteredCombinableArbitrary.java:211)
at com.navercorp.fixturemonkey.api.arbitrary.FilteredCombinableArbitrary.combined(FilteredCombinableArbitrary.java:104)
at com.navercorp.fixturemonkey.api.arbitrary.ObjectCombinableArbitrary.lambda$combined$0(ObjectCombinableArbitrary.java:51)
at java.base/java.util.HashMap.forEach(HashMap.java:1429)
at com.navercorp.fixturemonkey.api.arbitrary.ObjectCombinableArbitrary.combined(ObjectCombinableArbitrary.java:50)
at com.navercorp.fixturemonkey.api.arbitrary.NullInjectCombinableArbitrary.combined(NullInjectCombinableArbitrary.java:46)
at com.navercorp.fixturemonkey.api.arbitrary.TraceableCombinableArbitrary.combined(TraceableCombinableArbitrary.java:42)
at com.navercorp.fixturemonkey.api.arbitrary.FilteredCombinableArbitrary.combined(FilteredCombinableArbitrary.java:73)
at com.navercorp.fixturemonkey.resolver.ResolvedCombinableArbitrary.combined(ResolvedCombinableArbitrary.java:77)
... 16 more
Caused by: net.jqwik.api.TooManyFilterMissesException: Filtering [net.jqwik.engine.properties.arbitraries.randomized.ContainerGenerator@1abebef3] missed more than 10000 times.
at net.jqwik.engine.properties.arbitraries.randomized.FilteredGenerator.nextUntilAccepted(FilteredGenerator.java:38)
at net.jqwik.engine.properties.arbitraries.randomized.FilteredGenerator.next(FilteredGenerator.java:22)
at net.jqwik.engine.facades.SampleStreamFacade.lambda$sampleStream$2(SampleStreamFacade.java:68)
at net.jqwik.engine.execution.lifecycle.CurrentTestDescriptor.runWithDescriptor(CurrentTestDescriptor.java:17)
at net.jqwik.engine.facades.SampleStreamFacade.runInDescriptor(SampleStreamFacade.java:60)
at net.jqwik.engine.facades.SampleStreamFacade.lambda$wrapInDescriptor$1(SampleStreamFacade.java:55)
at java.base/java.util.stream.StreamSpliterators$InfiniteSupplyingSpliterator$OfRef.tryAdvance(StreamSpliterators.java:1367)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
at net.jqwik.api.Arbitrary.sample(Arbitrary.java:423)
at com.navercorp.fixturemonkey.api.jqwik.ArbitraryUtils.lambda$toCombinableArbitrary$0(ArbitraryUtils.java:38)
at com.navercorp.fixturemonkey.api.lazy.UnSafeLazyArbitraryImpl.getValue(UnSafeLazyArbitraryImpl.java:53)
at com.navercorp.fixturemonkey.api.arbitrary.LazyCombinableArbitrary.combined(LazyCombinableArbitrary.java:40)
at com.navercorp.fixturemonkey.api.arbitrary.NullInjectCombinableArbitrary.combined(NullInjectCombinableArbitrary.java:46)
at com.navercorp.fixturemonkey.api.arbitrary.TraceableCombinableArbitrary.combined(TraceableCombinableArbitrary.java:42)
at com.navercorp.fixturemonkey.api.arbitrary.FilteredCombinableArbitrary.combined(FilteredCombinableArbitrary.java:73)
The text was updated successfully, but these errors were encountered:
Describe the bug
When setting a constraint for a String, the arbitrary returned by the JqwikJavaArbitraryResolver will never generate an empty string, although the constraint may allow it.
With the following class, the string field will never get a string with length = 0, although I would expect it
And with the following, it will throw net.jqwik.api.TooManyFilterMissesException
I think that the problem can be in the filter at the end, that prevents empty strings to be generated.
https://github.com/naver/fixture-monkey/blob/1.1.1/fixture-monkey-api/src/main/java/com/navercorp/fixturemonkey/api/jqwik/JqwikJavaArbitraryResolver.java#L117
Your environment
Steps to reproduce
https://github.com/jagilpe/fixture-monkey-bug/blob/main/src/test/kotlin/FixtureMonkeyBugTest.kt#L25
Expected behaviour
The test should be green
Actual behaviour
The test ends with:
The text was updated successfully, but these errors were encountered: