[test] don't catch AssertionError from indexRandom(). just index and catch MapperParsingException

This commit is contained in:
Britta Weber 2015-09-10 14:42:11 +02:00
parent 314e1c8a3e
commit c10f116a84
1 changed files with 5 additions and 5 deletions

View File

@ -31,6 +31,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.geo.GeoShapeFieldMapper;
import org.elasticsearch.index.query.GeoShapeQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
@ -488,15 +489,14 @@ public class GeoShapeIntegrationIT extends ESIntegTestCase {
ShapeBuilder shape = RandomShapeGenerator.createShape(random());
try {
indexRandom(true, client().prepareIndex("geo_points_only", "type1", "1").setSource(jsonBuilder().startObject()
.field("location", shape).endObject()));
} catch (Throwable e) {
index("geo_points_only", "type1", "1", jsonBuilder().startObject().field("location", shape).endObject());
} catch (MapperParsingException e) {
// RandomShapeGenerator created something other than a POINT type, verify the correct exception is thrown
assertThat(e.getMessage(), containsString("MapperParsingException"));
assertThat(e.getMessage(), containsString("is configured for points only"));
assertThat(e.getCause().getMessage(), containsString("is configured for points only"));
return;
}
refresh();
// test that point was inserted
SearchResponse response = client().prepareSearch()
.setQuery(geoIntersectionQuery("location", shape))