Search in sources :

Example 6 with Shape

use of org.springframework.data.geo.Shape in project spring-data-mongodb by spring-projects.

the class MongoConvertersUnitTests method convertsSphereToDocumentAndBackCorrectly.

// DATAMONGO-858
@Test
public void convertsSphereToDocumentAndBackCorrectly() {
    Sphere sphere = new Sphere(new Point(1, 2), 3);
    Document document = GeoConverters.SphereToDocumentConverter.INSTANCE.convert(sphere);
    org.springframework.data.geo.Shape shape = GeoConverters.DocumentToSphereConverter.INSTANCE.convert(document);
    assertThat(shape, is((org.springframework.data.geo.Shape) sphere));
}
Also used : Sphere(org.springframework.data.mongodb.core.geo.Sphere) Shape(org.springframework.data.geo.Shape) Shape(org.springframework.data.geo.Shape) Point(org.springframework.data.geo.Point) Document(org.bson.Document) Test(org.junit.Test)

Aggregations

Point (org.springframework.data.geo.Point)6 Shape (org.springframework.data.geo.Shape)6 Test (org.junit.Test)5 Document (org.bson.Document)4 Polygon (org.springframework.data.geo.Polygon)2 Query (org.springframework.data.mongodb.core.query.Query)2 PartTree (org.springframework.data.repository.query.parser.PartTree)2 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 Optional (java.util.Optional)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Range (org.springframework.data.domain.Range)1 Sort (org.springframework.data.domain.Sort)1 Box (org.springframework.data.geo.Box)1 Circle (org.springframework.data.geo.Circle)1 Distance (org.springframework.data.geo.Distance)1 Metrics (org.springframework.data.geo.Metrics)1 PropertyPath (org.springframework.data.mapping.PropertyPath)1