|
@@ -20,18 +20,31 @@ public class HamletParserTest {
|
20
|
20
|
@Test
|
21
|
21
|
public void testChangeHamletToLeon() {
|
22
|
22
|
String inputLine = "Change Hamlet to Leon. Change Hamlet to Leon.";
|
23
|
|
- String[] searchStr = {"Hamlet", "Horatio"};
|
24
|
|
- String[] repStr = {"Leon", "Tariq"};
|
|
23
|
+ String[] searchStr = {"Hamlet"};
|
|
24
|
+ String[] repStr = {"Leon"};
|
25
|
25
|
String fileName = "test.txt";
|
26
|
26
|
HamletParser test = new HamletParser(fileName, searchStr, repStr);
|
27
|
27
|
String actual = test.getHamletData();
|
28
|
|
- String expect = "Change Leon to Leon. Change Leon to Leon.\n";
|
|
28
|
+ String expect = "Change Leon to Leon. Change Leon to Leon.\n" +
|
|
29
|
+ "Change Horatio to Tariq. Change Horatio to Tariq.\n";
|
29
|
30
|
Assert.assertEquals(expect, actual);
|
30
|
31
|
}
|
31
|
|
-
|
32
|
32
|
@Test
|
33
|
33
|
public void testChangeHoratioToTariq() {
|
34
|
34
|
String inputLine = "Change Horatio to Tariq. Change Horatio to Tariq.";
|
|
35
|
+ String[] searchStr = {"Horatio"};
|
|
36
|
+ String[] repStr = {"Tariq"};
|
|
37
|
+ String fileName = "test.txt";
|
|
38
|
+ HamletParser test = new HamletParser(fileName, searchStr, repStr);
|
|
39
|
+ String actual = test.getHamletData();
|
|
40
|
+ String expect = "Change Hamlet to Leon. Change Hamlet to Leon.\n" +
|
|
41
|
+ "Change Tariq to Tariq. Change Tariq to Tariq.\n";
|
|
42
|
+ Assert.assertEquals(expect, actual);
|
|
43
|
+ }
|
|
44
|
+
|
|
45
|
+ @Test
|
|
46
|
+ public void testChangeHoratioToTariqAndHamletToLeon() {
|
|
47
|
+ String inputLine = "Change Horatio to Tariq. Change Horatio to Tariq.";
|
35
|
48
|
String[] searchStr = {"Hamlet", "Horatio"};
|
36
|
49
|
String[] repStr = {"Leon", "Tariq"};
|
37
|
50
|
String fileName = "test.txt";
|
|
@@ -45,10 +58,22 @@ public class HamletParserTest {
|
45
|
58
|
|
46
|
59
|
@Test
|
47
|
60
|
public void testFindHoratio() {
|
|
61
|
+ String[] searchStr = {"Hamlet", "Horatio"};
|
|
62
|
+ String[] repStr = {"Leon", "Tariq"};
|
|
63
|
+ String fileName = "hamlet.txt";
|
|
64
|
+ HamletParser test = new HamletParser(fileName, searchStr, repStr);
|
|
65
|
+ Boolean actual = test.getHamletData().contains("Horatio");
|
|
66
|
+ Assert.assertEquals(false, actual);
|
48
|
67
|
}
|
49
|
68
|
|
50
|
69
|
@Test
|
51
|
70
|
public void testFindHamlet() {
|
|
71
|
+ String[] searchStr = {"Hamlet", "Horatio"};
|
|
72
|
+ String[] repStr = {"Leon", "Tariq"};
|
|
73
|
+ String fileName = "hamlet.txt";
|
|
74
|
+ HamletParser test = new HamletParser(fileName, searchStr, repStr);
|
|
75
|
+ Boolean actual = test.getHamletData().contains("Hamlet");
|
|
76
|
+ Assert.assertEquals(false, actual);
|
52
|
77
|
}
|
53
|
78
|
}
|
54
|
79
|
|