-
-
Notifications
You must be signed in to change notification settings - Fork 314
/
Copy pathPalindromeIndexTest.java
81 lines (49 loc) · 1.27 KB
/
PalindromeIndexTest.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
package palimdromeIndex;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class PalindromeIndexTest {
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 {
PalindromeIndex.isPalindrome(null);
}
@Test
public void emptyStringTest() throws Exception {
input = "";
assertTrue(PalindromeIndex.isPalindrome(input));
}
@Test
public void singleCharTest() throws Exception {
input = "H";
assertTrue(PalindromeIndex.isPalindrome(input));
}
@Test
public void alphaNumericPalindromeTest() throws Exception {
input = "1234321";
assertTrue(PalindromeIndex.isPalindrome(input));
}
@Test
public void validPalindromeTest() throws Exception {
input = "madam";
assertTrue(PalindromeIndex.isPalindrome(input));
}
@Test
public void invalidWordPalindromeTest() throws Exception {
input = "rotators";
assertFalse(PalindromeIndex.isPalindrome(input));
}
@Test
public void invalidPalindromeTest() throws Exception {
input = "I am a tester";
assertFalse(PalindromeIndex.isPalindrome(input));
}
}