Last active
August 30, 2020 21:26
-
-
Save jdmarble/df0c0db22dfcd40921fdbd0a1b7bb864 to your computer and use it in GitHub Desktop.
Builders with lots of ints stopped working in jqwik 1.3.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.jqwik.api.Arbitraries; | |
import net.jqwik.api.Arbitrary; | |
import net.jqwik.api.Combinators; | |
import net.jqwik.api.ForAll; | |
import net.jqwik.api.Property; | |
import net.jqwik.api.Provide; | |
public class ThingTest { | |
@Property(edgeCases = EdgeCasesMode.NONE) | |
public void my_property(@ForAll("things") final List<Thing> thing) { | |
// Spams the following warning, despite "EdgeCasesMode.NONE" | |
// Aug 30, 2020 2:23:01 PM net.jqwik.engine.facades.EdgeCasesFacadeImpl logTooManyEdgeCases | |
// WARNING: Combinatorial explosion of edge case generation. Stopped creating more after 10000 generated cases | |
} | |
@Provide | |
public Arbitrary<List<Thing>> things() { | |
return Combinators.withBuilder(Thing.Builder::new). | |
use(Arbitraries.integers()).in(Thing.Builder::setA). | |
use(Arbitraries.integers()).in(Thing.Builder::setB). | |
use(Arbitraries.integers()).in(Thing.Builder::setC). | |
use(Arbitraries.integers()).in(Thing.Builder::setD). | |
use(Arbitraries.integers()).in(Thing.Builder::setE). | |
use(Arbitraries.integers()).in(Thing.Builder::setF). | |
use(Arbitraries.integers()).in(Thing.Builder::setG). | |
use(Arbitraries.integers()).in(Thing.Builder::setH). | |
use(Arbitraries.integers()).in(Thing.Builder::setI). | |
build(Thing.Builder::build). | |
list(); | |
} | |
} | |
public final class Thing { | |
private final int a; | |
private final int b; | |
private final int c; | |
private final int d; | |
private final int e; | |
private final int f; | |
private final int g; | |
private final int h; | |
private final int i; | |
private Thing(final Builder builder) { | |
a = builder.a; | |
b = builder.b; | |
c = builder.c; | |
d = builder.d; | |
e = builder.e; | |
f = builder.f; | |
g = builder.g; | |
h = builder.h; | |
i = builder.i; | |
} | |
public static class Builder { | |
private int a; | |
private int b; | |
private int c; | |
private int d; | |
private int e; | |
private int f; | |
private int g; | |
private int h; | |
private int i; | |
public Builder setA(final int a) { | |
this.a = a; | |
return this; | |
} | |
public Builder setB(final int b) { | |
this.b = b; | |
return this; | |
} | |
public Builder setC(final int c) { | |
this.c = c; | |
return this; | |
} | |
public Builder setD(final int d) { | |
this.d = d; | |
return this; | |
} | |
public Builder setE(final int e) { | |
this.e = e; | |
return this; | |
} | |
public Builder setF(final int f) { | |
this.f = f; | |
return this; | |
} | |
public Builder setG(final int g) { | |
this.g = g; | |
return this; | |
} | |
public Builder setH(final int h) { | |
this.h = h; | |
return this; | |
} | |
public Builder setI(final int i) { | |
this.i = i; | |
return this; | |
} | |
public Thing build() { | |
return new Thing(this); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment