Search in sources :

Example 1 with GeoTag

use of com.xrtb.geo.GeoTag in project XRTB by benmfaul.

the class TestGeoNode method testSolution.

/**
	 * Test the solution doesn't return null
	 * @throws Exception on file errors
	 */
@Test
public void testSolution() throws Exception {
    GeoTag z = new GeoTag();
    z.initTags("data/zip_codes_states.csv", "data/unique_geo_zipcodes.txt");
    Solution s = z.getSolution(42.378, 71.227);
    assertNotNull(s);
//System.out.println(s.toString());
}
Also used : GeoTag(com.xrtb.geo.GeoTag) Solution(com.xrtb.geo.Solution) Test(org.junit.Test)

Example 2 with GeoTag

use of com.xrtb.geo.GeoTag in project XRTB by benmfaul.

the class TestGeoTag method testHaversignCalc.

@Test
public void testHaversignCalc() {
    try {
        GeoTag z = new GeoTag();
        z.initTags("data/zip_codes_states.csv", "data/unique_geo_zipcodes.txt");
        Solution p = null;
        long time = System.currentTimeMillis();
        p = z.getSolution(42.378, -71.227);
        assertTrue(p.code == 2138);
        assertTrue(p.state.equals("MA"));
        assertTrue(p.county.equals("Middlesex"));
        assertTrue(p.city.equals("Cambridge"));
    } catch (Exception error) {
        error.printStackTrace();
        fail(error.toString());
    }
}
Also used : GeoTag(com.xrtb.geo.GeoTag) Solution(com.xrtb.geo.Solution) Test(org.junit.Test)

Aggregations

GeoTag (com.xrtb.geo.GeoTag)2 Solution (com.xrtb.geo.Solution)2 Test (org.junit.Test)2