Search in sources :

Example 11 with NearbyLocation

use of org.codice.ddf.spatial.geocoding.context.NearbyLocation in project ddf by codice.

the class TestGeoNamesQueryLuceneIndex method testNearestCitiesWithBlankWKT.

@Test(expected = java.text.ParseException.class)
public void testNearestCitiesWithBlankWKT() throws java.text.ParseException, GeoEntryQueryException {
    String testPoint = "";
    final int requestedMaxResults = 2;
    final int actualResults = 0;
    final List<NearbyLocation> nearestCities = directoryIndex.getNearestCities(testPoint, 50, requestedMaxResults);
    assertThat(nearestCities.size(), is(actualResults));
}
Also used : NearbyLocation(org.codice.ddf.spatial.geocoding.context.NearbyLocation) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 12 with NearbyLocation

use of org.codice.ddf.spatial.geocoding.context.NearbyLocation in project ddf by codice.

the class TestGeoNamesLocalIndex method testGetNearbyCitiesParseException.

@Test
public void testGetNearbyCitiesParseException() throws ParseException, GeoEntryQueryException {
    when(geoEntryQueryable.getNearestCities("POINT(1.0 20)", 50, 1)).thenThrow(new ParseException("", 1));
    NearbyLocation returnedNearbyLocation = geoNamesLocalIndex.getNearbyCity("POINT(1.0 20)");
    assertThat(returnedNearbyLocation, nullValue());
}
Also used : NearbyLocation(org.codice.ddf.spatial.geocoding.context.NearbyLocation) ParseException(java.text.ParseException) Test(org.junit.Test)

Aggregations

NearbyLocation (org.codice.ddf.spatial.geocoding.context.NearbyLocation)12 Test (org.junit.Test)10 Matchers.anyString (org.mockito.Matchers.anyString)4 GeoEntryQueryException (org.codice.ddf.spatial.geocoding.GeoEntryQueryException)2 Point (org.locationtech.spatial4j.shape.Point)2 PointImpl (org.locationtech.spatial4j.shape.impl.PointImpl)2 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 JSONObject (net.minidev.json.JSONObject)1 IndexReader (org.apache.lucene.index.IndexReader)1 CustomScoreQuery (org.apache.lucene.queries.CustomScoreQuery)1 FunctionQuery (org.apache.lucene.queries.function.FunctionQuery)1 BooleanQuery (org.apache.lucene.search.BooleanQuery)1 BoostQuery (org.apache.lucene.search.BoostQuery)1 DisjunctionMaxQuery (org.apache.lucene.search.DisjunctionMaxQuery)1 IndexSearcher (org.apache.lucene.search.IndexSearcher)1 Query (org.apache.lucene.search.Query)1