1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.atlassian.fugue;
17
18 import org.junit.Test;
19
20 import java.util.function.Function;
21
22 import static io.atlassian.fugue.Functions.compose;
23 import static io.atlassian.fugue.Functions.matches;
24 import static io.atlassian.fugue.Option.some;
25
26 public class FunctionMatcherTest {
27 Function<Integer, Option<Integer>> toInt(final int check) {
28 return input -> (check == input) ? some(input) : Option.<Integer> none();
29 }
30
31 @Test(expected = NullPointerException.class) public void nullFirst() {
32 matches(null, toInt(1));
33 }
34
35 @Test(expected = NullPointerException.class) public void nullSecond() {
36 compose(toInt(1), null);
37 }
38
39 }