-
-
Notifications
You must be signed in to change notification settings - Fork 314
/
Copy pathSentencePalindromeTest.java
99 lines (59 loc) · 1.62 KB
/
SentencePalindromeTest.java
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package sentencePalindrome;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class SentencePalindromeTest {
private String input;
@Before
public void setUp() throws Exception {
input = null;
}
@After
public void tearDown() throws Exception {
}
@Test(expected = NullPointerException.class)
public void nullStringTest() throws Exception {
SentencePalindrome.isPalindrome(null);
}
@Test
public void emptyStringTest() throws Exception {
input = "";
assertTrue(SentencePalindrome.isPalindrome(input));
}
@Test
public void multipleWhiteSpaceTest() throws Exception {
input = "A Santa at Nasa";
assertTrue(SentencePalindrome.isPalindrome(input));
}
@Test
public void singleCharTest() throws Exception {
input = "H";
assertTrue(SentencePalindrome.isPalindrome(input));
}
@Test
public void punctuationTest() throws Exception {
input = "Eva, can I see bees in a cave?";
assertTrue(SentencePalindrome.isPalindrome(input));
}
@Test
public void unicodeTest() throws Exception {
input = "Step on no pet.";
assertFalse(SentencePalindrome.isPalindrome(input));
}
@Test
public void alphaNumericPalindromeTest() throws Exception {
input = "Air 2 an a2ria";
assertTrue(SentencePalindrome.isPalindrome(input));
}
@Test
public void validPalindromeTest() throws Exception {
input = "No lemon no melon";
assertTrue(SentencePalindrome.isPalindrome(input));
}
@Test
public void invalidPalindromeTest() throws Exception {
input = "I am a tester";
assertFalse(SentencePalindrome.isPalindrome(input));
}
}