| 1 | |
|---|
| 2 | package atmsdriver.model; |
|---|
| 3 | |
|---|
| 4 | import atmsdriver.model.Station.DIRECTION; |
|---|
| 5 | import java.util.ArrayList; |
|---|
| 6 | import junit.framework.TestCase; |
|---|
| 7 | import org.w3c.dom.Element; |
|---|
| 8 | |
|---|
| 9 | /** |
|---|
| 10 | * |
|---|
| 11 | * @author jdalbey |
|---|
| 12 | */ |
|---|
| 13 | public 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.getStationMeta(); |
|---|
| 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 | /** |
|---|
| 77 | * TODO: Test of toXML method, of class Station. |
|---|
| 78 | */ |
|---|
| 79 | |
|---|
| 80 | } |
|---|