forked from functionaljava/functionaljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringsTest.java
More file actions
67 lines (54 loc) · 1.49 KB
/
Copy pathStringsTest.java
File metadata and controls
67 lines (54 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package fj.function;
import fj.Function;
import org.junit.Test;
import static fj.F1Functions.o;
import static fj.Function.compose;
import static fj.function.Strings.*;
import static org.junit.Assert.*;
import static org.hamcrest.core.Is.is;
public class StringsTest {
@Test
public void testLines() {
assertThat(compose(unlines(), lines()).f("one two three"), is("one two three"));
}
@Test
public void testLinesEmpty() {
assertThat(o(unlines(), lines()).f(""), is(""));
}
@Test
public void testLength() {
assertThat(length.f("functionaljava"), is(14));
}
@Test
public void testMatches() {
assertThat(matches.f("foo").f("foo"), is(true));
}
@Test
public void testContains() {
assertThat(contains.f("bar").f("foobar1"), is(true));
}
@Test(expected = NullPointerException.class)
public void testIsEmptyException() {
assertThat(isEmpty.f(null), is(true));
}
@Test
public void testIsEmpty() {
assertThat(isEmpty.f(""), is(true));
}
@Test
public void testIsNotNullOrEmpty() {
assertThat(isNotNullOrEmpty.f("foo"), is(true));
}
@Test
public void testIsNullOrEmpty() {
assertThat(isNullOrEmpty.f(null), is(true));
}
@Test
public void testIsNotNullOrBlank() {
assertThat(isNotNullOrBlank.f("foo"), is(true));
}
@Test
public void testIsNullOrBlank() {
assertThat(isNullOrBlank.f(" "), is(true));
}
}