From 8376ed30f83c9193025da5962de5f5d78edfa185 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Tue, 24 Nov 2015 12:57:27 +1100 Subject: Add an implicit generator for Sets --- .../java/au/id/zancanaro/javacheck/object/GeneratorProvider.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main/java/au/id/zancanaro/javacheck/object') diff --git a/src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java b/src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java index 827ba3f..c975933 100644 --- a/src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java +++ b/src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java @@ -11,6 +11,7 @@ import java.lang.reflect.TypeVariable; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; import static au.id.zancanaro.javacheck.Generators.*; @@ -81,6 +82,11 @@ public interface GeneratorProvider { List.class.getTypeParameters()[0], new Annotation[0], provider)); + } else if (type == Set.class) { + return setOf(provider.getGenerator( + Set.class.getTypeParameters()[0], + new Annotation[0], + provider)); } else if (type == Map.class) { TypeVariable[] params = Map.class.getTypeParameters(); TypeVariable keyType = params[0], valueType = params[1]; -- cgit v1.2.3