-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWordDataTester.java
More file actions
62 lines (59 loc) · 1.96 KB
/
WordDataTester.java
File metadata and controls
62 lines (59 loc) · 1.96 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
57
58
59
60
61
62
import org.junit.*;
import static org.junit.Assert.*;
import java.util.LinkedList;
/**
* Tests the WordData class
*/
public class WordDataTester {
/**
* Tests the setIndex method and the getIndex method
*/
@Test
public void setIndexTest() {
WordData data = WordData.parseWordData("21 cat 5 20 36 38");
data.setIndex(5);
assertTrue("Test index getter and setter methods", 5 == data.getIndex());
}
/**
* Tests the setString method and the getString method
*/
@Test
public void setStringTest() {
WordData data = WordData.parseWordData("21 cat 5 20 36 38");
data.setString("This will be successful");
assertEquals("Test String getter and setter methods","This will be successful", data.getString());
}
/**
* Tests the setBool method and the getBool method
*/
@Test
public void setBoolTest() {
WordData data = WordData.parseWordData("21 cat 5 20 36 38");
data.setBool(true);
assertTrue("test 3", data.getBool());
data.setBool(false);
assertFalse("test 3", data.getBool());
}
/**
* Tests the setList method and the getList method
*/
@Test
public void setListTest() {
WordData data = WordData.parseWordData("21 cat 5 20 36 38");
LinkedList<Integer> list = new LinkedList<Integer> ();
data.setList(list);
assertTrue("Test setList method", data.getList().equals(list));
}
/**
* Tests the parseWordData method
*/
@Test
public void parseWordDataTest() {
WordData data = WordData.parseWordData("21 cat 5 20 36 38");
LinkedList<Integer> list = new LinkedList<Integer> ();
String string = "yes";
assertTrue("Test getEquals in parseWordData", data.getList().equals(list));
assertEquals("Test getString in parseWordData","21 cat 5 20 36 38", data.getString());
assertFalse("Test getBool in parseWordData", data.getBool());
}
}