1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.util.lang;
17
18 import static org.hamcrest.CoreMatchers.is;
19 import static org.hamcrest.MatcherAssert.assertThat;
20
21 import org.junit.Test;
22
23 import de.smartics.testdoc.annotations.TestDocHint;
24 import de.smartics.testdoc.annotations.Uut;
25
26
27
28
29 @Uut(type = StringFunction.class, method = "isLastChar(String, char)")
30 public class StringFunctionIsLastCharTest
31 {
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 @Test
47 @TestDocHint(sentence = "isLastChar: null, {any} -> false",
48 indexSortKey = "001")
49 public void noCharacterIsTheLastCharOfTheNullString()
50 {
51 final boolean result = StringFunction.isLastChar(null, 'A');
52 assertThat(result, is(false));
53 }
54
55 @Test
56 @TestDocHint(sentence = "isLastChar: \"\", {any} -> false",
57 indexSortKey = "002")
58 public void noCharacterIsTheLastCharOfTheEmptyString()
59 {
60 final boolean result = StringFunction.isLastChar("", 'A');
61 assertThat(result, is(false));
62 }
63
64 @Test
65 @TestDocHint(sentence = "isLastChar: \"a\", 'a' -> true",
66 indexSortKey = "003")
67 public void theLastCharOfAOneCharacterStringMatches()
68 {
69 final boolean result = StringFunction.isLastChar("a", 'a');
70 assertThat(result, is(true));
71 }
72
73 @Test
74 @TestDocHint(sentence = "isLastChar: \"a\", 'x' -> false",
75 indexSortKey = "004")
76 public void theLastCharOfAOneCharacterStringThatDoesNotMatch()
77 {
78 final boolean result = StringFunction.isLastChar("a", 'x');
79 assertThat(result, is(false));
80 }
81
82 @Test
83 @TestDocHint(sentence = "isLastChar: \"abc\", 'c' -> true",
84 indexSortKey = "005")
85 public void theLastCharOfAStringThatMatches()
86 {
87 final boolean result = StringFunction.isLastChar("abc", 'c');
88 assertThat(result, is(true));
89 }
90
91 @Test
92 @TestDocHint(sentence = "isLastChar: \"abc\", 'x' -> false",
93 indexSortKey = "006")
94 public void theLastCharOfAStringThatDoesNotMatch()
95 {
96 final boolean result = StringFunction.isLastChar("abc", 'x');
97 assertThat(result, is(false));
98 }
99
100
101
102 }