summaryrefslogtreecommitdiff
path: root/src/test/java/au/id/zancanaro/SimpleGenerator.java
blob: 1b1d5700c1d3c297f16d38e339e2f8426337cd22 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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<Integer> generator = Generator
                .pure(10)
                .flatMap((value) ->
                        Generator.pure(value + 10));
        Assert.assertEquals(
                (Object) 20,
                generator.generate(null, 0).getValue());
    }
}