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
|
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.runners.JUnit4;
import java.util.Arrays;
public class SampleTest {
@Test
public void testEvenString() {
String s = "abcdef";
String s1 = "HelloWorld";
assertEquals("Should handle even string","[ab, cd, ef]", Arrays.toString(StringSplit.solution(s)));
assertEquals("Should handle even string","[He, ll, oW, or, ld]", Arrays.toString(StringSplit.solution(s1)));
}
@Test
public void testOddString() {
String s = "abcde";
String s1 = "LovePizza";
assertEquals("Should handle odd string","[ab, cd, e_]", Arrays.toString(StringSplit.solution(s)));
assertEquals("Should handle odd string","[Lo, ve, Pi, zz, a_]", Arrays.toString(StringSplit.solution(s1)));
}
@Test
public void testEmptyString() {
String s = "";
assertEquals("Should handle empty string","[]", Arrays.toString(StringSplit.solution(s)));
}
}
|