Warning: Can't use blame annotator:
svn blame failed on trunk/test/atmsdriver/model/StationTest.java: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator/trunk/test/atmsdriver/model/StationTest.java @ 343

Revision 343, 2.3 KB checked in by jdalbey, 7 years ago (diff)

Fix defect #117. Update HighwaysTest?.java for new highway model.

RevLine 
1
2package atmsdriver.model;
3
4import atmsdriver.model.Station.DIRECTION;
5import java.util.ArrayList;
6import junit.framework.TestCase;
7import org.w3c.dom.Element;
8
9/**
10 *
11 * @author jdalbey
12 */
13public class StationTest extends TestCase {
14    Station alpha;
15    public StationTest(String testName) {
16        super(testName);
17    }
18   
19    @Override
20    protected void setUp() throws Exception {
21        super.setUp();
22        alpha = new Station(1,2,3,"A",new ArrayList<LoopDetector>(), 4, DIRECTION.NORTH, 1.0);
23    }
24   
25    @Override
26    protected void tearDown() throws Exception {
27        super.tearDown();
28    }
29
30    /**
31     * Test of getHighwayNumber method, of class Station.
32     */
33    public void testGetHighwayNumber() {
34        System.out.println("getHighwayNumber");
35        assertEquals(4, alpha.routeNumber);
36    }
37
38    /**
39     * Test of getDirection method, of class Station.
40     */
41    public void testGetDirection() {
42        System.out.println("getDirection");
43        assertEquals(DIRECTION.NORTH, alpha.direction);
44    }
45
46    /**
47     * Test of getStationMeta method, of class Station.
48     */
49    public void testGetStationMeta() {
50        System.out.println("getStationMeta");
51        String expResult = "2 3 4 N 1.0 0 A\n";
52        String result = alpha.toCondensedFormat(true);
53        assertEquals(expResult, result);
54    }
55
56    /**
57     * Test of getPostmile method, of class Station.
58     */
59    public void testGetPostmile() {
60        System.out.println("getPostmile");
61        assertEquals(1.0, alpha.postmile,0.1);
62    }
63
64    /**
65     * Test of compareTo method, of class Station.
66     */
67    public void testCompareTo() {
68        System.out.println("compareTo");
69        Station beta = new Station(1,2,3,"B",new ArrayList<LoopDetector>(), 4, DIRECTION.NORTH, 2.0);
70        int expResult = 0;
71        assertEquals(-1, alpha.compareTo(beta));
72        assertEquals(1, beta.compareTo(alpha));
73        assertEquals(0, beta.compareTo(beta));
74    }
75
76    public void testMatches()
77    {
78        Station alpha = new Station(1,2,3,"A",new ArrayList<LoopDetector>(), 4, DIRECTION.NORTH, 2.0);
79        assertTrue(alpha.matches(DIRECTION.NORTH, 2.0));
80        assertFalse(alpha.matches(DIRECTION.NORTH,2.1));
81    }
82    /**
83     * TODO: Test of toXML method, of class Station.
84     */
85   
86}
Note: See TracBrowser for help on using the repository browser.