-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestCustomer.java
159 lines (137 loc) · 4.43 KB
/
TestCustomer.java
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* The test class TestCustomer.
*/
public class TestCustomer
{
@Test
public void testToString()
{
//create a new customer object
Customer c = new Customer(5, 0.0);
//call toString
String info = c.toString();
//this is what the method should give
String shouldBe = "Customer 5 has an arrival time of 0.00 mins, a wait time of 0.00 mins, a service time of 0.00 mins, and departs at 0.00 mins.";
assertEquals(info, shouldBe);
}
@Test
public void testcsvToString()
{
//create a new customer object
Customer c = new Customer(5, 0.0);
//call toString
String info = c.csvString();
//this is what the method should give
String shouldBe = "5,0.0,0.0,0.0,0.0,OVERFLOW";
assertEquals(info, shouldBe);
}
@Test
public void testgetarrivalTime()
{
//create a new customer object
Customer c = new Customer(5, 0.0);
//call getserveTime--should return 0.0
double time = c.getarrivalTime();
//compare a Theoretical array with an actual Array by casting time to an int
int [] Theoretical = {0};
int [] Actual = {(int)time};
assertArrayEquals(Actual, Theoretical);
}
@Test
public void testgetwaitTime()
{
//create a new customer object
Customer c = new Customer(5, 0.0);
//call getserveTime--should return 0.0
double time = c.getwaitTime();
//compare a Theoretical array with an actual Array by casting time to an int
int [] Theoretical = {0};
int [] Actual = {(int)time};
assertArrayEquals(Actual, Theoretical);
}
@Test
public void testgetserveTime()
{
//create a new customer object
Customer c = new Customer(5, 0.0);
//call getserveTime--should return 0.0
double time = c.getserveTime();
//compare a Theoretical array with an actual Array by casting time to an int
int [] Theoretical = {0};
int [] Actual = {(int)time};
assertArrayEquals(Actual, Theoretical);
}
@Test
public void testgetdepartTime()
{
//create a new customer object
Customer c = new Customer(5, 0.0);
//call getserveTime--should return 0.0
double time = c.getdepartTime();
//compare a Theoretical array with an actual Array by casting time to an int
int [] Theoretical = {0};
int [] Actual = {(int)time};
assertArrayEquals(Actual, Theoretical);
}
@Test
public void testgetCustomerNum()
{
//create a new customer object
Customer c = new Customer(5, 0.0);
//call getCustomerNum--should return 0.0
int num = c.getCustomerNum();
assertEquals(5, num);
}
@Test
public void testsetarrivalTime()
{
//Create a new customer object
Customer c = new Customer(5, 0.0);
//set the time
c.setarrivalTime(5.0);
//get the time
double time = c.getarrivalTime();
//compare the times as ints
assertEquals((int)5.0,(int)time);
}
@Test
public void testsetserveTime()
{
//Create a new customer object
Customer c = new Customer(5, 0.0);
//set the time
c.setserveTime(5.0);
//get the time
double time = c.getserveTime();
//compare the times as ints
assertEquals((int)5.0,(int)time);
}
@Test
public void testsetwaitTime()
{
//Create a new customer object
Customer c = new Customer(5, 0.0);
//set the time
c.setwaitTime(5.0);
//get the time
double time = c.getwaitTime();
//compare the times as ints
assertEquals((int)5.0,(int)time);
}
@Test
public void testsetdepartTime()
{
//Create a new customer object
Customer c = new Customer(5, 0.0);
//set the time
c.setdepartTime(5.0);
//get the time
double time = c.getdepartTime();
//compare the times as ints
assertEquals((int)5.0,(int)time);
}
}