-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInformationTest.java
More file actions
117 lines (104 loc) · 3.17 KB
/
Copy pathInformationTest.java
File metadata and controls
117 lines (104 loc) · 3.17 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
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import static org.junit.Assert.*;
import org.junit.Test;
import java.util.*;
/**
* The test class EventTest.
*
* @author Khalid ALmotaery
* @version 11/7/2020
*/
public class InformationTest
{
/**
* Tests the assingCustomers Methods by comapring the results from a LinkedList and an ArrayList
*/
@Test
public void assignCustomersLinkedListTest()
{
Information info = new Information();
Iterator<Customer> itr;
ArrayList<Customer> c;
LinkedList<Customer> ll;
String ActualText = "";
String ExpectedText = "";
//info.assignCustomers(1);
ll = info.getCustomerLinkedList();
c = info.getCustomerList();
itr=ll.iterator();
//checks if the customers arrival times match when using LinkedList and ArrayLists:
while(itr.hasNext()){
ActualText = ActualText+itr.next().arrivalTime;
}
for(int k =0; k<c.size(); k++){
ExpectedText=ExpectedText+c.get(k).arrivalTime;
}
assertEquals(ExpectedText,ActualText); // result of test
}
/**
* Tests the assingCustomers Methods by comapring the results from a ArrayDeque and an ArrayList
*/
@Test
public void assignCustomersArrayDequeTest()
{
Information info = new Information();
Iterator<Customer> itr;
ArrayList<Customer> c;
ArrayDeque<Customer> ab;
String ActualText = "";
String ExpectedText = "";
//info.assignCustomers(1);
ab = info.getCustomerDeque();
c = info.getCustomerList();
itr=ab.iterator();
//checks if the customers arrival times match when using ArrayDeque and ArrayLists:
while(itr.hasNext()){
ActualText = ActualText+itr.next().arrivalTime;
}
for(int k =0; k<c.size(); k++){
ExpectedText=ExpectedText+c.get(k).arrivalTime;
}
assertEquals(ExpectedText,ActualText); // result of test
}
/**
* Tests the range of the profit
*/
@Test
public void getProfitRangeTest()
{
Information info = new Information();
boolean inRange=false;
boolean expectedRange = true;
int acutal = info.getProfit();
if(acutal>0&&acutal<10){
inRange=true;
}
assertEquals(inRange,expectedRange);
}
/**
* Tests the range of the service time
*/
@Test
public void getSeviceTimeRangeTest()
{
Information info = new Information();
boolean inRange=false;
boolean expectedRange = true;
int acutal = info.getServiceTime();
if(acutal>30&&acutal<300){
inRange=true;
}
assertEquals(expectedRange,inRange);
}
@Test
public void getStaffingCostTest()
{
Information info = new Information();
int act = info.getStaffingCost();
int ex = 300;
assertEquals(ex,act);
}
}