[TEST] fix geo query failures when no types are defined
This commit is contained in:
parent
19792516ba
commit
678e1be5cf
|
@ -114,7 +114,7 @@ public class GeoDistanceRangeQueryTests extends BaseQueryTestCase<GeoDistanceRan
|
|||
assertThat(geoQuery.fieldName(), equalTo(queryBuilder.fieldName()));
|
||||
if (queryBuilder.point() != null) {
|
||||
assertThat(geoQuery.lat(), equalTo(queryBuilder.point().lat()));
|
||||
assertThat(geoQuery.lat(), equalTo(queryBuilder.point().lat()));
|
||||
assertThat(geoQuery.lon(), equalTo(queryBuilder.point().lon()));
|
||||
}
|
||||
assertThat(geoQuery.geoDistance(), equalTo(queryBuilder.geoDistance()));
|
||||
if (queryBuilder.from() != null && queryBuilder.from() instanceof Number) {
|
||||
|
@ -139,6 +139,17 @@ public class GeoDistanceRangeQueryTests extends BaseQueryTestCase<GeoDistanceRan
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden here to ensure the test is only run if at least one type is
|
||||
* present in the mappings. Geo queries do not execute if the field is not
|
||||
* explicitly mapped
|
||||
*/
|
||||
@Override
|
||||
public void testToQuery() throws IOException {
|
||||
assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
|
||||
super.testToQuery();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullFieldName() {
|
||||
GeoDistanceRangeQueryBuilder builder = new GeoDistanceRangeQueryBuilder(null);
|
||||
|
|
|
@ -71,6 +71,17 @@ public class GeohashCellQueryBuilderTests extends BaseQueryTestCase<GeohashCellQ
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden here to ensure the test is only run if at least one type is
|
||||
* present in the mappings. Geo queries do not execute if the field is not
|
||||
* explicitly mapped
|
||||
*/
|
||||
@Override
|
||||
public void testToQuery() throws IOException {
|
||||
assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
|
||||
super.testToQuery();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullField() {
|
||||
GeohashCellQuery.Builder builder = new Builder(null);
|
||||
|
|
Loading…
Reference in New Issue