| 1 | |
|---|
| 2 | package atmsdriver.model; |
|---|
| 3 | |
|---|
| 4 | import atmsdriver.model.Station.DIRECTION; |
|---|
| 5 | import java.util.ArrayList; |
|---|
| 6 | import java.util.Set; |
|---|
| 7 | import junit.framework.TestCase; |
|---|
| 8 | |
|---|
| 9 | /** |
|---|
| 10 | * |
|---|
| 11 | * @author jdalbey |
|---|
| 12 | */ |
|---|
| 13 | public 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 | } |
|---|