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

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

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

Line 
1
2package atmsdriver.model;
3
4import atmsdriver.model.Station.DIRECTION;
5import java.util.ArrayList;
6import java.util.Set;
7import junit.framework.TestCase;
8
9/**
10 *
11 * @author jdalbey
12 */
13public class HighwayTest extends TestCase
14{
15    Station alpha;   
16    Station beta;
17    public HighwayTest(String testName)
18    {
19        super(testName);
20    }
21   
22    @Override
23    protected void setUp() throws Exception
24    {
25        super.setUp();
26        alpha = new Station(1,2,3,"A",new ArrayList<LoopDetector>(), 4, Station.DIRECTION.NORTH, 1.0);       
27        beta = new Station(1,2,3,"B",new ArrayList<LoopDetector>(), 4, Station.DIRECTION.SOUTH, 1.0);       
28    }
29   
30    @Override
31    protected void tearDown() throws Exception
32    {
33        super.tearDown();
34    }
35
36    public void testToString()
37    {
38        System.out.println("toString");
39        Highway instance = new Highway(5,null);
40        String expResult = "5";
41        String result = instance.toString();
42        assertEquals(expResult, result);
43    }
44    public void testDirections()
45    {
46        ArrayList<Station> stations = new ArrayList<Station>();
47        stations.add(alpha);
48        stations.add(beta);
49        Highway h1 = new Highway(5,stations);
50        Set<DIRECTION> dirs = h1.availDirs;
51        assertTrue(dirs.contains(DIRECTION.NORTH));
52        assertTrue(dirs.contains(DIRECTION.SOUTH));
53    }
54}
Note: See TracBrowser for help on using the repository browser.