Tuple4 is not public despite being part of the API
See original GitHub issueTesting Problem
To circumvent the limitation of only being able to combine 4 arbitraries, I’d like to group them into tuples, but Tuple4 is not public.
Suggested Solution
Make Tuple4 public.
Discussion
Ideally, there would also be some kind of ArbitraryBuilder, as writing them from scratch is quite cumbersome and using my workaround is also not great:
@Provide()
Arbitrary<ComplexObject> complexObjectGen() {
Arbitrary<Foo> foos1 = fooGen();
Arbitrary<Foo> foos2 = fooGen();
Arbitrary<Foo> foos3 = fooGen();
Arbitrary<Foo> foos4 = fooGen();
Arbitrary<Bar> bars1 = barGen();
Arbitrary<Bar> bars2 = barGen();
Arbitrary<Bar> bars3 = barGen();
Arbitrary<Bar> bars4 = barGen();
Arbitrary<Tuple4<Foo, Foo, Bar, Bar>> combine1 = Combinators.combine(foos1, foos2, bars1, bars2).as((f1, f2, b1, b2) -> tuple(f1, f2, b1, b2));
Arbitrary<Tuple4<Foo, Foo, Bar, Bar>> combine2 = Combinators.combine(foos3, foos4, bars3, bars4).as((f3, f4, b3, b4) -> tuple(f3, f4, b3, b4));
return Combinators.combine(combine1, combine2).as((c1, c2) -> ComplexObject.create(c1.v1, c1.v2, c1.v3, c1.v4, c2.v1, c2.v2, c2.v3, c2.v4));
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Class Tuple4<T0,T1,T2,T3> - The Apache Software Foundation!
A tuple with 4 fields. Tuples are strongly typed; each field may be of a separate type. The fields of the tuple can...
Read more >Using Pairs or 2-tuples in Java [duplicate] - Stack Overflow
I don't think there is a general purpose tuple class in Java but a custom one might be as easy as the following:...
Read more >Scala Standard Library 2.12.17 - scala.Tuple4
A tuple of 4 elements; the canonical representation of a scala.Product4. _1. Element 1 of this Tuple4. _2. Element 2 of this Tuple4....
Read more >C#7 Tuple Support · Issue #1230 · JamesNK/Newtonsoft.Json
As a root object I don't think this would be possible as Tuple element names are erased upon compilation and are only present...
Read more >Tuple<T1,T2,T3,T4>.IStructuralComparable ... - Microsoft Learn
Compares the current Tuple<T1,T2,T3,T4> object to a specified object by using a specified comparer and returns an integer that indicates whether the current ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Available in 0.8.4-SNAPSHOT. Will be released in version 0.8.4.
Added possibility to combine up to 8 arbitraries in https://github.com/jlink/jqwik/commit/d8dd9eef19944637fd5196984788aed01a1ec8ab