-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathResultTest.java
More file actions
32 lines (25 loc) · 839 Bytes
/
ResultTest.java
File metadata and controls
32 lines (25 loc) · 839 Bytes
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
package hackrank.algorithm.string.palindrome;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
class ResultTest {
@Test
void palindromeIndex_AlreadyPalindrome_NoSolution() {
int index = Result.palindromeIndex("aa");
assertThat(index).isEqualTo(-1);
}
@Test
void palindromeIndex_NoPalindromePossible_NoSolution() {
int index = Result.palindromeIndex("abc");
assertThat(index).isEqualTo(-1);
}
@Test
void palindromeIndex_AlmostPalindrome_RemoveFirstChar() {
int index = Result.palindromeIndex("baa");
assertThat(index).isEqualTo(0);
}
@Test
void palindromeIndex_AlmostPalindrome_RemoveLastChar() {
int index = Result.palindromeIndex("aaab");
assertThat(index).isEqualTo(3);
}
}