|
@@ -1,31 +1,49 @@
|
|
1
|
+import org.junit.Assert;
|
1
|
2
|
import org.junit.Before;
|
2
|
3
|
import org.junit.Test;
|
3
|
4
|
|
|
5
|
+import java.util.regex.Matcher;
|
|
6
|
+import java.util.regex.Pattern;
|
|
7
|
+
|
4
|
8
|
import static org.junit.Assert.*;
|
5
|
9
|
|
6
|
10
|
public class HamletParserTest {
|
7
|
|
- private String hamletText;
|
|
11
|
+
|
8
|
12
|
private HamletParser hamletParser;
|
9
|
13
|
|
10
|
14
|
@Before
|
11
|
15
|
public void setUp() {
|
12
|
16
|
this.hamletParser = new HamletParser();
|
13
|
|
- this.hamletText = hamletParser.getHamletData();
|
14
|
17
|
}
|
15
|
18
|
|
16
|
19
|
@Test
|
17
|
20
|
public void testChangeHamletToLeon() {
|
|
21
|
+ hamletParser.changeHamletToLeon();
|
|
22
|
+ boolean expected = false;
|
|
23
|
+ boolean actual = hamletParser.findHamlet();
|
|
24
|
+ Assert.assertEquals(expected, actual);
|
|
25
|
+
|
18
|
26
|
}
|
19
|
27
|
|
20
|
28
|
@Test
|
21
|
29
|
public void testChangeHoratioToTariq() {
|
|
30
|
+ hamletParser.changeHoratioToTariq();
|
|
31
|
+ boolean expected = false;
|
|
32
|
+ boolean actual = hamletParser.findHoratio();
|
|
33
|
+ Assert.assertEquals(expected, actual);
|
22
|
34
|
}
|
23
|
35
|
|
24
|
36
|
@Test
|
25
|
37
|
public void testFindHoratio() {
|
|
38
|
+ boolean expected = hamletParser.getHamletData().toLowerCase().contains("horatio");
|
|
39
|
+ boolean actual = hamletParser.findHoratio();
|
|
40
|
+ Assert.assertEquals(expected, actual);
|
26
|
41
|
}
|
27
|
42
|
|
28
|
43
|
@Test
|
29
|
44
|
public void testFindHamlet() {
|
|
45
|
+ boolean expected = hamletParser.getHamletData().toLowerCase().contains("hamlet");
|
|
46
|
+ boolean actual = hamletParser.findHamlet();
|
|
47
|
+ Assert.assertEquals(expected, actual);
|
30
|
48
|
}
|
31
|
49
|
}
|