/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package tmcsim.utilities; import java.util.Scanner; import junit.framework.TestCase; /** * * @author jdalbey */ public class VehicleDetectionStationTest extends TestCase { public VehicleDetectionStationTest(String testName) { super(testName); } @Override protected void setUp() throws Exception { super.setUp(); } @Override protected void tearDown() throws Exception { super.tearDown(); } String allFields = "1202464 57 N 12 59 8100 21.16 10.426 33.929701 -117.879881 .975 ML 4 LAMBERT 973"; String noLength = "1202428 57 N 12 59 8100 20 9.266 33.912859 -117.883163 OR 1 IMPERIAL 2 972"; String noCiy = "1202475 57 S 12 59 22.06 11.411 33.94149 -117.874675 1.269 ML 4 TONNER 987 "; String noCitynoLen = "1202470 57 S 12 59 22 11.351 33.940956 -117.875322 OR 1 BONNER 987"; public void testScan1() { Scanner lineIn = new Scanner(allFields).useDelimiter("\t"); VehicleDetectionStation vds1 = new VehicleDetectionStation(lineIn); String result = vds1.toString(); assertEquals("LAMBERT",vds1.street); } public void testScan2() { Scanner lineIn = new Scanner(noLength).useDelimiter("\t"); VehicleDetectionStation vds1 = new VehicleDetectionStation(lineIn); String result = vds1.toString(); assertEquals("IMPERIAL 2",vds1.street); } public void testScan3() { Scanner lineIn = new Scanner(noCiy).useDelimiter("\t"); VehicleDetectionStation vds1 = new VehicleDetectionStation(lineIn); String result = vds1.toString(); assertEquals("TONNER",vds1.street); } public void testScan4() { Scanner lineIn = new Scanner(noCitynoLen).useDelimiter("\t"); VehicleDetectionStation vds1 = new VehicleDetectionStation(lineIn); String result = vds1.toString(); assertEquals("BONNER",vds1.street); } }