From 27fcf37206591c774d79ec60de8d404ed83378ac Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Tue, 2 Jun 2015 18:10:13 +1000 Subject: Fix up some static analysis warnings and improve @DataPoint detection --- src/main/java/au/id/zancanaro/javacheck/Generators.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main/java/au/id/zancanaro/javacheck/Generators.java') diff --git a/src/main/java/au/id/zancanaro/javacheck/Generators.java b/src/main/java/au/id/zancanaro/javacheck/Generators.java index eab3eed..548bd29 100644 --- a/src/main/java/au/id/zancanaro/javacheck/Generators.java +++ b/src/main/java/au/id/zancanaro/javacheck/Generators.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.function.Function; import java.util.function.Predicate; +@SuppressWarnings("unused") public final class Generators { private Generators() { } @@ -26,6 +27,12 @@ public final class Generators { }; } + public static Generator noShrink(Generator gen) { + return (random, size) -> new RoseTree<>( + gen.generate(random, size).getValue(), + Collections.emptyList()); + } + @SafeVarargs public static Generator oneOf(Generator... gens) { return integer(0, gens.length).flatMap(index -> gens[index]); @@ -91,8 +98,6 @@ public final class Generators { }; } - ; - public static Generator> listOf(Generator gen) { return (random, size) -> { Generator countGen = sized(s -> integer(0, s)); -- cgit v1.2.3