package atmsdriver.model; import atmsdriver.model.Station.DIRECTION; import java.util.ArrayList; import junit.framework.TestCase; import org.w3c.dom.Element; /** * * @author jdalbey */ public class StationTest extends TestCase { Station alpha; public StationTest(String testName) { super(testName); } @Override protected void setUp() throws Exception { super.setUp(); alpha = new Station(1,2,3,"A",new ArrayList(), 4, DIRECTION.NORTH, 1.0); } @Override protected void tearDown() throws Exception { super.tearDown(); } /** * Test of getHighwayNumber method, of class Station. */ public void testGetHighwayNumber() { System.out.println("getHighwayNumber"); assertEquals(4, alpha.routeNumber); } /** * Test of getDirection method, of class Station. */ public void testGetDirection() { System.out.println("getDirection"); assertEquals(DIRECTION.NORTH, alpha.direction); } /** * Test of getStationMeta method, of class Station. */ public void testGetStationMeta() { System.out.println("getStationMeta"); String expResult = "2 3 4 N 1.0 0 A\n"; String result = alpha.toCondensedFormat(true); assertEquals(expResult, result); } /** * Test of getPostmile method, of class Station. */ public void testGetPostmile() { System.out.println("getPostmile"); assertEquals(1.0, alpha.postmile,0.1); } /** * Test of compareTo method, of class Station. */ public void testCompareTo() { System.out.println("compareTo"); Station beta = new Station(1,2,3,"B",new ArrayList(), 4, DIRECTION.NORTH, 2.0); int expResult = 0; assertEquals(-1, alpha.compareTo(beta)); assertEquals(1, beta.compareTo(alpha)); assertEquals(0, beta.compareTo(beta)); } public void testMatches() { Station alpha = new Station(1,2,3,"A",new ArrayList(), 4, DIRECTION.NORTH, 2.0); assertTrue(alpha.matches(DIRECTION.NORTH, 2.0)); assertFalse(alpha.matches(DIRECTION.NORTH,2.1)); } /** * TODO: Test of toXML method, of class Station. */ }