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());
}
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());
}
}