Warning: Can't use blame annotator:
svn blame failed on trunk/test/atmsdriver/model/PostmileCoordsTest.java: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator/trunk/test/atmsdriver/model/PostmileCoordsTest.java @ 244

Revision 244, 1.7 KB checked in by jdalbey, 7 years ago (diff)

Added new classes: Postmile and PostmileCoords? and a unit test.

RevLine 
1
2package atmsdriver.model;
3
4import java.io.FileInputStream;
5import java.io.FileNotFoundException;
6import java.util.Iterator;
7import java.util.Scanner;
8import junit.framework.TestCase;
9
10/**
11 *
12 * @author jdalbey
13 */
14public class PostmileCoordsTest extends TestCase
15{
16    private PostmileCoords pmc;
17   
18    public PostmileCoordsTest(String testName)
19    {
20        super(testName);
21    }
22   
23    @Override
24    protected void setUp() throws Exception
25    {
26        super.setUp();
27    }
28   
29    @Override
30    protected void tearDown() throws Exception
31    {
32        super.tearDown();
33    }
34
35    public void testLoad() throws FileNotFoundException
36    {
37
38        System.out.println("load");
39        String line1 = "ORA 4 5.55, 33.33, -117.117\nORA 4 6.66, 33.33, -117.117";
40        Scanner scan = new Scanner(line1).useDelimiter("\\A"); 
41        pmc = new PostmileCoords();
42        pmc.load(scan);
43        PostmileCoords.Postmile pm = new PostmileCoords.Postmile("ORA 4 5.55", "33.33", "-117.117");
44        assertEquals(pmc.get(0),pm);
45        assert(pmc.size() == 2);
46    }
47    public void testIterator() throws FileNotFoundException
48    {
49        System.out.println("iterator");
50        testLoad();
51        int count = 0;
52        for (Object pm: pmc)
53        {
54            count++;
55        }
56        assert(count == 2);
57    }
58    public void testFind() throws FileNotFoundException
59    {
60        System.out.println("find");
61        testLoad();
62        PostmileCoords.Postmile result = pmc.find("ORA 4 6.66");
63        assertNotNull(result);
64        PostmileCoords.Postmile pm = new PostmileCoords.Postmile("ORA 4 6.66", "33.33", "-117.117");
65        assertEquals(pm,result);
66        PostmileCoords.Postmile result2 = pmc.find("X");
67        assertNull(result2);
68    }
69}
Note: See TracBrowser for help on using the repository browser.