-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathHamletParserTest.java
More file actions
56 lines (45 loc) · 1.53 KB
/
HamletParserTest.java
File metadata and controls
56 lines (45 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import com.sun.tools.doclets.formats.html.SourceToHTMLConverter;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.junit.Assert.*;
public class HamletParserTest {
private String hamletText;
private HamletParser hamletParser;
@Before
public void setUp() {
this.hamletParser = new HamletParser();
this.hamletText = hamletParser.getHamletData();
}
@Test
public void testChangeHamletToLeon() {
String expected = "Leon";
String actual = hamletParser.changeHamletToLeon("Hamlet");
assertEquals(expected, actual);
}
@Test
public void testChangeHoratioToTariq() {
String expected = "Tariq";
String actual = hamletParser.changeHoratioToTariq("Horatio");
assertEquals(expected, actual);
}
@Test
public void testFindHoratio() {
boolean expected = true;
boolean actual = hamletParser.findHoratio("This is a string with the name Horatio in it");
assertEquals(expected, actual);
}
@Test
public void testFindHamlet() {
boolean expected = true;
boolean actual = hamletParser.findHamlet("This is a string with the name Hamlet in it");
assertEquals(expected, actual);
}
@Test
public void testChangedBothNames(){
String expected = "Tariq and Leon are friends";
String actual = hamletParser.changeBothNames("Horatio and Hamlet are friends");
assertEquals(expected, actual);
}
}