use of org.springframework.data.geo.Polygon in project spring-data-mongodb by spring-projects.
the class MappingMongoConverterUnitTests method shouldReadEntityWithGeoPolygonCorrectly.
// DATAMONGO-858
@Test
public void shouldReadEntityWithGeoPolygonCorrectly() {
ClassWithGeoPolygon object = new ClassWithGeoPolygon();
object.polygon = new Polygon(new Point(1, 2), new Point(3, 4), new Point(4, 5));
org.bson.Document document = new org.bson.Document();
converter.write(object, document);
ClassWithGeoPolygon result = converter.read(ClassWithGeoPolygon.class, document);
assertThat(result, is(notNullValue()));
assertThat(result.polygon, is(object.polygon));
}
use of org.springframework.data.geo.Polygon in project spring-data-mongodb by spring-projects.
the class MongoConvertersUnitTests method convertsPolygonToDocumentAndBackCorrectly.
// DATAMONGO-858
@Test
public void convertsPolygonToDocumentAndBackCorrectly() {
Polygon polygon = new Polygon(new Point(1, 2), new Point(2, 3), new Point(3, 4), new Point(5, 6));
Document document = GeoConverters.PolygonToDocumentConverter.INSTANCE.convert(polygon);
Shape shape = GeoConverters.DocumentToPolygonConverter.INSTANCE.convert(document);
assertThat(shape, is((org.springframework.data.geo.Shape) polygon));
}
Aggregations