|
@@ -1,11 +1,17 @@
|
|
1
|
+import org.junit.Assert;
|
1
|
2
|
import org.junit.Before;
|
2
|
3
|
import org.junit.Test;
|
3
|
4
|
|
|
5
|
+import java.util.ArrayList;
|
|
6
|
+import java.util.regex.Matcher;
|
|
7
|
+import java.util.regex.Pattern;
|
|
8
|
+
|
4
|
9
|
import static org.junit.Assert.*;
|
5
|
10
|
|
6
|
11
|
public class HamletParserTest {
|
7
|
12
|
private String hamletText;
|
8
|
13
|
private HamletParser hamletParser;
|
|
14
|
+ // HamletParser hamletParserr = new HamletParser();
|
9
|
15
|
|
10
|
16
|
@Before
|
11
|
17
|
public void setUp() {
|
|
@@ -15,17 +21,46 @@ public class HamletParserTest {
|
15
|
21
|
|
16
|
22
|
@Test
|
17
|
23
|
public void testChangeHamletToLeon() {
|
|
24
|
+ ArrayList<Matcher> x = new ArrayList<>();
|
|
25
|
+ int counter = 0;
|
|
26
|
+ hamletParser.changeHamlet();
|
|
27
|
+ hamletParser.changeHamlet2();
|
|
28
|
+ Pattern hamlet = Pattern.compile("^Hamlet|HAMLET");
|
|
29
|
+ Matcher matches = hamlet.matcher(hamletText);
|
|
30
|
+ x.add(matches);
|
|
31
|
+ x.isEmpty();
|
|
32
|
+ Assert.assertTrue(x.isEmpty() == false);
|
18
|
33
|
}
|
19
|
34
|
|
20
|
35
|
@Test
|
21
|
36
|
public void testChangeHoratioToTariq() {
|
|
37
|
+ ArrayList<Matcher> x = new ArrayList<Matcher>();
|
|
38
|
+ int counter = 0;
|
|
39
|
+ hamletParser.changeHoratio();
|
|
40
|
+ hamletParser.changeHoratio2();
|
|
41
|
+ Pattern hamlet = Pattern.compile("^Horatio|HORATIO");
|
|
42
|
+ Matcher matches = hamlet.matcher(hamletText);
|
|
43
|
+ x.add(matches);
|
|
44
|
+ x.isEmpty();
|
|
45
|
+// if(matches.find()){
|
|
46
|
+// counter++;
|
|
47
|
+// }
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+// if(hamletText.contains(hamlet.split("")){
|
|
51
|
+//
|
|
52
|
+// }
|
|
53
|
+ Assert.assertTrue(x.isEmpty() == false);
|
22
|
54
|
}
|
23
|
55
|
|
24
|
56
|
@Test
|
25
|
57
|
public void testFindHoratio() {
|
|
58
|
+ Assert.assertTrue(hamletText.contains("Horatio") == true);
|
|
59
|
+
|
26
|
60
|
}
|
27
|
61
|
|
28
|
62
|
@Test
|
29
|
63
|
public void testFindHamlet() {
|
|
64
|
+ Assert.assertTrue(hamletText.contains("Hamlet") == true);
|
30
|
65
|
}
|
31
|
66
|
}
|