|
@@ -1,6 +1,9 @@
|
1
|
1
|
import org.junit.Before;
|
2
|
2
|
import org.junit.Test;
|
3
|
3
|
|
|
4
|
+import java.util.regex.Matcher;
|
|
5
|
+import java.util.regex.Pattern;
|
|
6
|
+
|
4
|
7
|
import static org.junit.Assert.*;
|
5
|
8
|
|
6
|
9
|
public class HamletParserTest {
|
|
@@ -15,17 +18,33 @@ public class HamletParserTest {
|
15
|
18
|
|
16
|
19
|
@Test
|
17
|
20
|
public void testChangeHamletToLeon() {
|
|
21
|
+ String expected = hamletParser.changeHamletToLeon();
|
|
22
|
+ assertTrue(hamletParser.getHamletData().contains("Hamlet"));
|
|
23
|
+ assertTrue(expected.contains("Leon"));
|
|
24
|
+ assertFalse(expected.contains("Hamlet"));
|
18
|
25
|
}
|
19
|
26
|
|
20
|
27
|
@Test
|
21
|
28
|
public void testChangeHoratioToTariq() {
|
|
29
|
+ String expected = hamletParser.changeHoratioToTariq();
|
|
30
|
+ assertTrue(expected.contains("Tariq"));
|
|
31
|
+ assertTrue(hamletParser.getHamletData().contains("Horatio"));
|
|
32
|
+ assertFalse(expected.contains("Horatio"));
|
22
|
33
|
}
|
23
|
34
|
|
24
|
35
|
@Test
|
25
|
36
|
public void testFindHoratio() {
|
|
37
|
+ Pattern pattern = Pattern.compile("Horatio");
|
|
38
|
+ boolean expected = hamletParser.getHamletData().contains("Horatio");
|
|
39
|
+ boolean actual = hamletParser.findHoratio();
|
|
40
|
+ assertEquals(expected, actual);
|
26
|
41
|
}
|
27
|
42
|
|
28
|
43
|
@Test
|
29
|
44
|
public void testFindHamlet() {
|
|
45
|
+ Pattern pattern = Pattern.compile("Hamlet");
|
|
46
|
+ boolean expected = hamletParser.getHamletData().contains("Hamlet");
|
|
47
|
+ boolean actual = hamletParser.findHamlet();
|
|
48
|
+ assertEquals(expected, actual);
|
30
|
49
|
}
|
31
|
50
|
}
|