From d29e1d49116c66adab72b1c1bb49c1fa3d4f8140 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Sat, 30 May 2015 02:00:43 +1000 Subject: Initial commit: only works for plain int typed arguments --- src/test/java/au/id/zancanaro/SimpleGenerator.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/java/au/id/zancanaro/SimpleGenerator.java (limited to 'src/test/java/au/id/zancanaro/SimpleGenerator.java') diff --git a/src/test/java/au/id/zancanaro/SimpleGenerator.java b/src/test/java/au/id/zancanaro/SimpleGenerator.java new file mode 100644 index 0000000..1b1d570 --- /dev/null +++ b/src/test/java/au/id/zancanaro/SimpleGenerator.java @@ -0,0 +1,19 @@ +package au.id.zancanaro; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.Random; + +public class SimpleGenerator { + @Test + public void testSimpleGeneratorFlatmap() throws Exception { + Generator generator = Generator + .pure(10) + .flatMap((value) -> + Generator.pure(value + 10)); + Assert.assertEquals( + (Object) 20, + generator.generate(null, 0).getValue()); + } +} -- cgit v1.2.3