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
which worked just fine with jgiven 1.3.1, now fails using jgiven 2.0.0 with the following exception:
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
at java.base/java.util.Objects.checkIndex(Objects.java:385)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at java.base/java.util.Collections$UnmodifiableList.get(Collections.java:1501)
at com.tngtech.jgiven.report.analysis.CaseArgumentAnalyser.findArgumentNames(CaseArgumentAnalyser.java:114)
at com.tngtech.jgiven.report.analysis.CaseArgumentAnalyser.analyze(CaseArgumentAnalyser.java:69)
at com.tngtech.jgiven.report.analysis.CaseArgumentAnalyser.analyze(CaseArgumentAnalyser.java:32)
at com.tngtech.jgiven.report.impl.CommonReportHelper.finishReport(CommonReportHelper.java:26)
at com.tngtech.jgiven.junit5.JGivenExtension.afterAll(JGivenExtension.java:75)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Note that it fails only when the test case containing the null value comes after a test case containing only non-null values. Also note that the position of the null value does not change anything, "data1, null" also fails when put after "data1, data2" but not when it comes first.
The text was updated successfully, but these errors were encountered:
I'm a bit confused by your test setup. You seem to be using JUnit5 with a JUnit5 parameterized annotation, but you seem to giving a com.tngtech.dataprovider.Dataprovider annotation instead of the JUnit5 @ValueSource or @MethodSource
I honestly am surprised that this worked in the first place.
I switched to the JUnit5 @CsvSource instead of @DataProvider, but I'm still having the same exact exception.
Note that each individual test succeeds, then the exception occurs after all the tests from the test class have finished running and JUnit5 then considers the entire test class failed.
Found the issue. I had to rewrite how we grab Args from JUnit 5 and made the error of using List.of instead of Arrays.asList...
The former unfortunately does not support null inputs.
A parameterized test with a null value in its second test case, such as this one:
which worked just fine with jgiven 1.3.1, now fails using jgiven 2.0.0 with the following exception:
Note that it fails only when the test case containing the null value comes after a test case containing only non-null values. Also note that the position of the null value does not change anything,
"data1, null"
also fails when put after"data1, data2"
but not when it comes first.The text was updated successfully, but these errors were encountered: