diff options
author | Carlo Zancanaro <carlo@zancanaro.id.au> | 2015-11-24 12:57:27 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@zancanaro.id.au> | 2015-11-24 12:57:27 +1100 |
commit | 8376ed30f83c9193025da5962de5f5d78edfa185 (patch) | |
tree | 6b79a0a9bdedce965d2905de2bc2a6ff10fbccc9 /src/main/java/au/id/zancanaro/javacheck/object | |
parent | 1b0565b1f6b4d5009da689ba5d486bce203e4905 (diff) |
Add an implicit generator for Sets
Diffstat (limited to 'src/main/java/au/id/zancanaro/javacheck/object')
-rw-r--r-- | src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java | 6 |
1 files changed, 6 insertions, 0 deletions
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]; |