-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestProcess.java
More file actions
119 lines (87 loc) · 3.18 KB
/
TestProcess.java
File metadata and controls
119 lines (87 loc) · 3.18 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package JavaDevs;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import java.util.LinkedList;
import org.junit.After;
import org.junit.Before;
import org.junit.Assert;
public class TestProcess {
private LinkedList<LinkedList<String>> list;
Process test = new Process();
@Before
public void setUp() {
list.get(0).add("AM");
list.get(1).add("Name");
list.get(2).add("Surname");
list.get(0).add("8170067");
list.get(0).add("8170133");
list.get(0).add("8170036");
list.get(0).add("8170053");
list.get(0).add("8170091");
list.get(0).add("8170057");
list.get(0).add("8170126");
list.get(1).add("Giannis");
list.get(2).add("Methenitis");
list.get(1).add("Danai");
list.get(2).add("Tzoumpa");
list.get(1).add("Ioanna");
list.get(2).add("Kalogeropoulou");
list.get(1).add("Pantelis");
list.get(2).add("Kirpoglou");
list.get(1).add("Alice");
list.get(2).add("Douzgou");
list.get(1).add("Anna");
list.get(2).add("Kotsa");
list.get(1).add("Aristi");
list.get(2).add("Syriou");
}
@Test
public LinkedList<LinkedList<String>> testinput (LinkedList<LinkedList<String>> list) {
list.get(0).add("12345");
list.get(1).add("TestName");
list.get(2).add("TestSurname");
Assert.assertFalse("Failure - new record has not been inputed", !list.get(0).contains("12345"));
Assert.assertEquals("Failure - wrong size", 8, list.get(0).size());
return list;
}
@Test
public LinkedList<LinkedList<String>> testDeleteTheBase(LinkedList<LinkedList<String>> list) {
Assert.assertFalse("failure - the base has not been deleted", list.isEmpty());
return list;
}
@Test
public LinkedList<LinkedList<String>> testDeleteRecord(LinkedList<LinkedList<String>> list) {
list.get(0).remove(2);
list.get(1).remove(2);
list.get(2).remove(2);
Assert.assertTrue("failure - element has not been deleted", list.get(0).contains("8170133"));
Assert.assertEquals("failure - wrong size", 8, list.get(0).size());
return list;
}
@Test
public LinkedList<LinkedList<String>> testViewEverything(LinkedList<LinkedList<String>> list) {
Assert.assertFalse("failure - there is nothing to be viewed/list is empty", list.isEmpty());
return list;
} //end of testViewEverything method
@Test
public LinkedList<LinkedList<String>> testViewbyPrimKey(LinkedList<LinkedList<String>> list) {
Assert.assertTrue("failure - does not contain primary key", list.contains("8170053"));
Assert.assertEquals("failure - wrong size", list.get(0).size(), 7);
return list;
} //end of testViewbyPrimKey method
@Test
public LinkedList<LinkedList<String>> testViewbyItem(LinkedList<LinkedList<String>> list) {
Assert.assertFalse("failure - does not contain the item", list.contains("Anna"));
Assert.assertEquals("failure - wrong size", list.get(0).size(), 7);
return list;
} //end of testViewbyItem
@Test
public void testEdit(LinkedList<LinkedList<String>> list) {
LinkedList<LinkedList<String>> editedList = test.edit(list);
Assert.assertEquals("Failure - no correlation between values", editedList.get(test.p).get(test.ak), test.newValue);
}
@After
public void tearDown() {
list = null;
}
}