|
@@ -1,3 +1,4 @@
|
|
1
|
+import org.junit.Assert;
|
1
|
2
|
import org.junit.Before;
|
2
|
3
|
import org.junit.Test;
|
3
|
4
|
|
|
@@ -6,11 +7,13 @@ import static org.junit.Assert.*;
|
6
|
7
|
public class HamletParserTest {
|
7
|
8
|
private String hamletText;
|
8
|
9
|
private HamletParser hamletParser;
|
|
10
|
+ private ReplaceNames replaceNames;
|
9
|
11
|
|
10
|
12
|
@Before
|
11
|
13
|
public void setUp() {
|
12
|
14
|
this.hamletParser = new HamletParser();
|
13
|
15
|
this.hamletText = hamletParser.getHamletData();
|
|
16
|
+ this.replaceNames = new ReplaceNames();
|
14
|
17
|
}
|
15
|
18
|
|
16
|
19
|
@Test
|
|
@@ -22,7 +25,35 @@ public class HamletParserTest {
|
22
|
25
|
}
|
23
|
26
|
|
24
|
27
|
@Test
|
|
28
|
+ public void testIsHoratioTrue(){
|
|
29
|
+ boolean actual = replaceNames.isHoratio("hORatIo's");
|
|
30
|
+ Assert.assertTrue(actual);
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+ @Test
|
|
34
|
+ public void testIsHoratioFalse(){
|
|
35
|
+ boolean actual = replaceNames.isHoratio("notHoratio");
|
|
36
|
+ Assert.assertFalse(actual);
|
|
37
|
+ }
|
|
38
|
+
|
|
39
|
+ @Test
|
25
|
40
|
public void testFindHoratio() {
|
|
41
|
+ String test = "Horatio, horatio test test HORATIO, hORatIo";
|
|
42
|
+ int actual = replaceNames.findHoratio(test);
|
|
43
|
+ int expected = 4;
|
|
44
|
+ Assert.assertEquals(expected, actual);
|
|
45
|
+ }
|
|
46
|
+
|
|
47
|
+ @Test
|
|
48
|
+ public void testIsHamletTrue(){
|
|
49
|
+ boolean actual = replaceNames.isHamlet("HamLet's");
|
|
50
|
+ Assert.assertTrue(actual);
|
|
51
|
+ }
|
|
52
|
+
|
|
53
|
+ @Test
|
|
54
|
+ public void testIsHamletFalse(){
|
|
55
|
+ boolean actual = replaceNames.isHamlet("notHamLet");
|
|
56
|
+ Assert.assertFalse(actual);
|
26
|
57
|
}
|
27
|
58
|
|
28
|
59
|
@Test
|