jqwik-team / jqwik

Property-Based Testing on the JUnit Platform

Home Page:http://jqwik.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regress from 1.5.5 to 1.5.6 and still present in 1.7.1: Cannot inject List<Consumer<T>>

kepakiano opened this issue · comments

I'd like to inject a List<Consumer<Integer>> into a test like so:

    @Property
    void foo(@ForAll @Size(min = 1) List<Consumer<Integer>> integerConsumers){

    }

This worked in 1.5.5, broke in 1.5.6 and is still broken in 1.7.1.

StackTrace I'm getting:

java.lang.NullPointerException: Cannot invoke "Object.hashCode()" because "constant" is null
	at net.jqwik.engine.properties.arbitraries.randomized.AbstractFunctionGenerator.lambda$constantFunction$0(AbstractFunctionGenerator.java:46)
	at jdk.proxy1/jdk.proxy1.$Proxy11.hashCode(Unknown Source)
	at java.base/java.util.HashMap.hash(HashMap.java:338)
	at java.base/java.util.HashMap.put(HashMap.java:610)

I'm using a Java 17 runtime.

If making injecting a List<Consumer<Integer>> impossible was a deliberate decision for 1.5.6, please feel free to ignore this issue :)

Thank you for this amazing library!

@kepakiano Thanks for the catch. Does look like a bug at first glance. Will check.

Fix released in 1.7.2-SNAPSHOT

1.7.2 has been released

Thank you! We were able to upgrade to the latest version with this fix :)