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
|
package ca.mokhan.test;
import Q10.*;
import java.io.*;
import java.text.*;
import java.util.*;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class TrainTimeTableTest extends TestCase {
private TrainTimeTable subject;
private LinkedList<Station> stations =
new LinkedList<Station>(
Arrays.asList(
new Station("Vancouver", null, new Date(1546374600000l), 1),
new Station("Kamloops", new Date(1546408800000l), new Date(1546410900000l), 2),
new Station("Jasper", new Date(1546444800000l), new Date(1546450200000l), 2),
new Station("Edmonton", new Date(1546470000000l), new Date(1546473540000l), 2),
new Station("Saskatchewan", new Date(1546502400000l), new Date(1546503900000l), 3),
new Station("Winnipeg", new Date(1546548300000l), new Date(1546554600000l), 3),
new Station("Sioux Lookout", new Date(1546578120000l), new Date(1546580520000l), 4),
new Station("Hornepayne", new Date(1546616100000l), new Date(1546618200000l), 4),
new Station("Capreol", new Date(1546647480000l), new Date(1546649280000l), 5),
new Station("Toronto", new Date(1546680600000l), null, 5)));
public TrainTimeTableTest(String testName) {
super(testName);
this.subject = new TrainTimeTable(this.stations);
}
public static Test suite() {
return new TestSuite(TrainTimeTableTest.class);
}
public void test_delay_edmonton_30minutes() {
this.subject.delay("Edmonton", 30);
Station station = this.subject.stationIn("Edmonton");
assertNotNull(station);
assertEquals("Edmonton", station.getCity());
assertEquals("23:30", station.getArrival());
assertEquals("00:29", station.getDeparture());
assertEquals(3, station.getDay());
}
}
|