Geo: fix GeoWKTShapeParserTests (#44448)

Changes in #44187 introduced some optimization in the way shapes are
generated. These changes were not captured in GeoWKTShapeParserTests.

Relates #44187
This commit is contained in:
Igor Motov 2019-07-17 08:59:06 -04:00
parent cd5a334864
commit d3cb7bbc8f
1 changed files with 5 additions and 1 deletions

View File

@ -41,6 +41,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.geo.geometry.Geometry; import org.elasticsearch.geo.geometry.Geometry;
import org.elasticsearch.geo.geometry.GeometryCollection;
import org.elasticsearch.geo.geometry.Line; import org.elasticsearch.geo.geometry.Line;
import org.elasticsearch.geo.geometry.MultiLine; import org.elasticsearch.geo.geometry.MultiLine;
import org.elasticsearch.geo.geometry.MultiPoint; import org.elasticsearch.geo.geometry.MultiPoint;
@ -131,6 +132,9 @@ public class GeoWKTShapeParserTests extends BaseGeoParsingTestCase {
if (numPoints == 0) { if (numPoints == 0) {
expectedGeom = MultiPoint.EMPTY; expectedGeom = MultiPoint.EMPTY;
actual = new MultiPointBuilder(); actual = new MultiPointBuilder();
} else if (numPoints == 1) {
expectedGeom = points.get(0);
actual = new MultiPointBuilder(coordinates);
} else { } else {
expectedGeom = new MultiPoint(points); expectedGeom = new MultiPoint(points);
actual = new MultiPointBuilder(coordinates); actual = new MultiPointBuilder(coordinates);
@ -195,7 +199,7 @@ public class GeoWKTShapeParserTests extends BaseGeoParsingTestCase {
} }
Geometry expectedGeom; Geometry expectedGeom;
if (lines.isEmpty()) { if (lines.isEmpty()) {
expectedGeom = MultiLine.EMPTY; expectedGeom = GeometryCollection.EMPTY;
} else if (lines.size() == 1) { } else if (lines.size() == 1) {
expectedGeom = new Line(lines.get(0).getLats(), lines.get(0).getLons()); expectedGeom = new Line(lines.get(0).getLats(), lines.get(0).getLons());
} else { } else {