package test.java;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import com.xrtb.geo.GeoTag;
import com.xrtb.geo.Solution;

/**
 * Make sure GPS to zip code conversion works as expected.
 * @author Ben M. Faul
 *
 */
public class TestGeoTag  {

	@BeforeClass
	public static void setup() {
		try {
			Config.setup();
			System.out.println("******************  TestGeoTag");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@AfterClass
	public static void stop() {
		Config.teardown();
	}
	
	@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==2238);
		assertTrue(p.state.equals("MA"));
		assertTrue(p.county.equals("Middlesex"));
		} catch (Exception error) {
			error.printStackTrace();
			fail(error.toString());
		}
	}
}

package test.java;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import com.xrtb.geo.GeoTag;
import com.xrtb.geo.Solution;

/**
 * Make sure GPS to zip code conversion works as expected.
 * @author Ben M. Faul
 *
 */
public class TestGeoTag  {

	@BeforeClass
	public static void setup() {
		try {
			Config.setup();
			System.out.println("******************  TestGeoTag");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@AfterClass
	public static void stop() {
		Config.teardown();
	}
	
	@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());
		}
	}
}

Add the city for testing.
Add the city for testing.
