package twitter4j; import static org.junit.Assert.*; import org.junit.Test; public class TestGeoQuery { @Test public void testConstructor() { String ip = "192.168.2.1"; GeoQuery query = new GeoQuery(ip); assertNotNull(query); assertEquals(query.getIp(), ip); } @Test public void testConstructor2() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); assertNotNull(query); assertEquals(query.getLocation(), location); } @Test public void testSetGet1() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); String accuracy = "whatever"; query.setAccuracy(accuracy); assertEquals(query.getAccuracy(), accuracy); String accuracy2 = "never ever"; query.setAccuracy(accuracy2); assertEquals(query.getAccuracy(), accuracy2); } @Test public void testSetGet1a() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); String accuracy = "whatever"; query.accuracy(accuracy); assertEquals(query.getAccuracy(), accuracy); String accuracy2 = "never ever"; query.accuracy(accuracy2); assertEquals(query.getAccuracy(), accuracy2); } @Test public void testSetGet2() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); String granularity = "homer"; query.setGranularity(granularity); assertEquals(query.getGranularity(), granularity); String granularity2 = "simpson"; query.setGranularity(granularity2); assertEquals(query.getGranularity(), granularity2); } @Test public void testSetGet2a() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); String granularity = "homer"; query.granularity(granularity); assertEquals(query.getGranularity(), granularity); String granularity2 = "simpson"; query.granularity(granularity2); assertEquals(query.getGranularity(), granularity2); } @Test public void testSetGet3() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); int maxResults = 23; query.setMaxResults(maxResults); assertEquals(query.getMaxResults(), maxResults); int maxResults2 = 42; query.setMaxResults(maxResults2); assertEquals(query.getMaxResults(), maxResults2); } @Test public void testSetGet3a() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); int maxResults = 23; query.maxResults(maxResults); assertEquals(query.getMaxResults(), maxResults); int maxResults2 = 42; query.maxResults(maxResults2); assertEquals(query.getMaxResults(), maxResults2); } @Test public void testSetGet4() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); String string = ""; query.setQuery(string); assertEquals(query.getQuery(), string); String string2 = "42"; query.setQuery(string2); assertEquals(query.getQuery(), string2); } @Test public void testEquals1() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); assertTrue(query.equals(query)); } @Test public void testEquals2() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); assertFalse(query.equals(null)); } @Test public void testEquals3() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); assertTrue(query.equals(new GeoQuery(location))); } @Test public void testEquals4() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); String ip = "192.168.2.1"; GeoQuery query2 = new GeoQuery(ip); assertFalse(query.equals(query2)); } @Test public void testEquals5() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); GeoQuery query2 = new GeoQuery(location); String accuracy = "Lisa"; String granularity = "Bart"; int maxResults = 94; query.accuracy(accuracy).granularity(granularity) .maxResults(maxResults); query2.accuracy(accuracy).granularity(granularity) .maxResults(maxResults); assertTrue(query.equals(query2)); } @Test public void testEquals6() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); GeoQuery query2 = new GeoQuery(location); String accuracy = "Lisa"; String granularity = "Bart"; int maxResults = 94; query.accuracy(accuracy).granularity(granularity) .maxResults(maxResults); String accuracy2 = "Maggi"; query2.accuracy(accuracy2).granularity(granularity) .maxResults(maxResults); assertFalse(query.equals(query2)); } @Test public void testEquals7() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); GeoQuery query2 = new GeoQuery(location); String accuracy = "Lisa"; String granularity = "Bart"; int maxResults = 94; query.accuracy(accuracy).granularity(granularity) .maxResults(maxResults); String granularity2 = "Maggi"; query2.accuracy(accuracy).granularity(granularity2) .maxResults(maxResults); assertFalse(query.equals(query2)); } @Test public void testEquals8() { GeoLocation location = new GeoLocation(); GeoQuery query = new GeoQuery(location); GeoQuery query2 = new GeoQuery(location); String accuracy = "Lisa"; String granularity = "Bart"; int maxResults = 94; query.accuracy(accuracy).granularity(granularity) .maxResults(maxResults); int maxResults2 = 95; query2.accuracy(accuracy).granularity(granularity) .maxResults(maxResults2); assertFalse(query.equals(query2)); } }