Skip to content

Commit c01c226

Browse files
yasin3061pivovarit
authored andcommitted
BAEL-1334: Guide to Hibernate Spatial (eugenp#3183)
* BAEL-1334 Guide to Hibernate Spatial * BAEL-1334 Guide to Hibernate Spatial Moving the files to hibernate5 from libraries * Reverting the pom file * BAEL-1334 Guide to Hibernate Spatial * BAEL-1334 Guide to Hibernate Spatial Moving the files to hibernate5 from libraries * Reverting the pom file * BAEL-1334 Guide to Hibernate Spatial Improved assertions
1 parent 4e39bfb commit c01c226

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎hibernate5/src/test/java/com/baeldung/hibernate/HibernateSpatialTest.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
import javax.persistence.Query;
1515
import java.io.IOException;
1616

17+
import static org.assertj.core.api.Assertions.assertThat;
1718
import static org.junit.Assert.assertEquals;
19+
1820
import static org.junit.Assert.assertTrue;
1921

2022
public class HibernateSpatialTest {
@@ -76,10 +78,8 @@ public void shouldSelectAllPointsWithinPolygon() throws ParseException {
7678
Query query = session.createQuery("select p from PointEntity p where within(p.point, :area) = true",
7779
PointEntity.class);
7880
query.setParameter("area", wktToGeometry("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))"));
79-
assertEquals(3, query.getResultList().size());
80-
assertEquals("POINT (1 1)", ((PointEntity) query.getResultList().get(0)).getPoint().toString());
81-
assertEquals("POINT (1 2)", ((PointEntity) query.getResultList().get(1)).getPoint().toString());
82-
assertEquals("POINT (3 4)", ((PointEntity) query.getResultList().get(2)).getPoint().toString());
81+
assertThat(query.getResultList().stream().map(p -> ((PointEntity) p).getPoint().toString()))
82+
.containsOnly("POINT (1 1)", "POINT (1 2)", "POINT (3 4)");
8383
}
8484

8585
private void insertPoint(String point) throws ParseException {

0 commit comments

Comments
 (0)