|
@@ -1,8 +1,14 @@
|
|
1
|
+import org.junit.Assert;
|
1
|
2
|
import org.junit.Before;
|
2
|
3
|
import org.junit.Test;
|
|
4
|
+import org.omg.Messaging.SYNC_WITH_TRANSPORT;
|
|
5
|
+
|
|
6
|
+import java.util.regex.Pattern;
|
|
7
|
+import java.util.regex.Matcher;
|
3
|
8
|
|
4
|
9
|
import static org.junit.Assert.*;
|
5
|
10
|
|
|
11
|
+
|
6
|
12
|
public class HamletParserTest {
|
7
|
13
|
private String hamletText;
|
8
|
14
|
private HamletParser hamletParser;
|
|
@@ -14,18 +20,84 @@ public class HamletParserTest {
|
14
|
20
|
}
|
15
|
21
|
|
16
|
22
|
@Test
|
17
|
|
- public void testChangeHamletToLeon() {
|
|
23
|
+ public void testChangeHamletToLeon1()
|
|
24
|
+ {
|
|
25
|
+ HamletParser hamletParser = new HamletParser();
|
|
26
|
+
|
|
27
|
+ String input = "This is Hamlet.";
|
|
28
|
+
|
|
29
|
+ String expected = "This is Leon.";
|
|
30
|
+
|
|
31
|
+ String actual = hamletParser.replaceHamletWithLeon(input);
|
|
32
|
+
|
|
33
|
+ Assert.assertEquals(expected, actual);
|
|
34
|
+
|
18
|
35
|
}
|
19
|
36
|
|
20
|
37
|
@Test
|
21
|
|
- public void testChangeHoratioToTariq() {
|
|
38
|
+ public void testChangeHamletToLeon2()
|
|
39
|
+ {
|
|
40
|
+ HamletParser hamletParser = new HamletParser();
|
|
41
|
+
|
|
42
|
+ String testString = "This is HAMLET.";
|
|
43
|
+
|
|
44
|
+ String expected = "This is LEON.";
|
|
45
|
+
|
|
46
|
+ String actual = hamletParser.replaceHamletWithLeon(testString);
|
|
47
|
+
|
|
48
|
+ Assert.assertEquals(expected, actual);
|
|
49
|
+
|
22
|
50
|
}
|
23
|
51
|
|
|
52
|
+
|
|
53
|
+
|
24
|
54
|
@Test
|
25
|
|
- public void testFindHoratio() {
|
|
55
|
+ public void testChangeHoratioToTariq()
|
|
56
|
+ {
|
|
57
|
+ HamletParser hamletParser = new HamletParser();
|
|
58
|
+
|
|
59
|
+ String testString = "This is Horatio.";
|
|
60
|
+
|
|
61
|
+ String expected = "This is Tariq.";
|
|
62
|
+
|
|
63
|
+ String actual = hamletParser.replaceHoratioWithTariq(testString);
|
|
64
|
+
|
|
65
|
+ Assert.assertEquals(expected, actual);
|
|
66
|
+
|
|
67
|
+ }
|
|
68
|
+
|
|
69
|
+ @Test
|
|
70
|
+ public void testFindHoratio1()
|
|
71
|
+ {
|
|
72
|
+ boolean expected = true;
|
|
73
|
+ boolean actual = hamletParser.findHoratio("Horatio is here");
|
|
74
|
+ Assert.assertEquals(expected, actual);
|
26
|
75
|
}
|
27
|
76
|
|
28
|
77
|
@Test
|
29
|
|
- public void testFindHamlet() {
|
|
78
|
+ public void testFindHoratio2()
|
|
79
|
+ {
|
|
80
|
+ boolean expected = true;
|
|
81
|
+ boolean actual = hamletParser.findHoratio("HORATIO is here");
|
|
82
|
+ Assert.assertEquals(expected, actual);
|
|
83
|
+ }
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+ @Test
|
|
87
|
+ public void testFindHamlet1()
|
|
88
|
+ {
|
|
89
|
+ boolean expected = true;
|
|
90
|
+ boolean actual = hamletParser.findHamlet("Hamlet is here");
|
|
91
|
+ Assert.assertEquals(expected, actual);
|
|
92
|
+
|
|
93
|
+ }
|
|
94
|
+
|
|
95
|
+ @Test
|
|
96
|
+ public void testFindHamlet2()
|
|
97
|
+ {
|
|
98
|
+ boolean expected = true;
|
|
99
|
+ boolean actual = hamletParser.findHamlet("HAMLET is here");
|
|
100
|
+ Assert.assertEquals(expected, actual);
|
|
101
|
+
|
30
|
102
|
}
|
31
|
103
|
}
|