Skip to content

Commit 08e6d5f

Browse files
committed
update based on feedback
1 parent 847bcd0 commit 08e6d5f

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

jts/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
<junit.version>4.13.2</junit.version>
2222
<jts.version>1.20.0</jts.version>
2323
<qos.logback.version>1.5.18</qos.logback.version>
24+
<maven.compiler.plugin.version>3.14.0</maven.compiler.plugin.version>
25+
<maven.shade.plugin.version>3.2.4</maven.shade.plugin.version>
2426
</properties>
2527
<dependencies>
2628
<dependency>
@@ -58,7 +60,7 @@
5860
<plugin>
5961
<groupId>org.apache.maven.plugins</groupId>
6062
<artifactId>maven-compiler-plugin</artifactId>
61-
<version>3.14.0</version>
63+
<version>${maven.compiler.plugin.version}</version>
6264
<configuration>
6365
<source>${maven.compiler.source}</source>
6466
<target>${maven.compiler.target}</target>
@@ -69,7 +71,7 @@
6971
<plugin>
7072
<groupId>org.apache.maven.plugins</groupId>
7173
<artifactId>maven-shade-plugin</artifactId>
72-
<version>3.2.4</version>
74+
<version>${maven.shade.plugin.version}</version>
7375
<executions>
7476
<execution>
7577
<phase>package</phase>

jts/src/main/java/com/baeldung/jts/operations/JTSOperationUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class JTSOperationUtils {
88
private static final Logger log = LoggerFactory.getLogger(JTSOperationUtils.class);
99

10-
public static boolean isContainment(Geometry point, Geometry polygon) {
10+
public static boolean checkContainment(Geometry point, Geometry polygon) {
1111
boolean isInside = polygon.contains(point);
1212
log.info("Is the point inside polygon? {}", isInside);
1313
return isInside;

jts/src/test/java/com/baeldung/jts/JtsApplicationTests.java renamed to jts/src/test/java/com/baeldung/jts/JtsApplicationUnitTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@
66
import org.junit.Test;
77
import org.locationtech.jts.geom.Geometry;
88

9-
public class JtsApplicationTests {
9+
public class JtsApplicationUnitTest {
1010
@Test
11-
public void givenPolygon2D_whenContainPoint_thenContainmentIsTrueUnitTest() throws Exception {
11+
public void givenPolygon2D_whenContainPoint_thenContainmentIsTrue() throws Exception {
1212
Geometry point = GeometryFactoryUtil.readWKT("POINT (10 20)");
1313
Geometry polygon = GeometryFactoryUtil.readWKT("POLYGON ((0 0, 0 40, 40 40, 40 0, 0 0))");
14-
Assert.assertTrue(JTSOperationUtils.isContainment(point, polygon));
14+
Assert.assertTrue(JTSOperationUtils.checkContainment(point, polygon));
1515
}
1616

1717
@Test
18-
public void givenRectangle1_whenIntersectWithRectangle2_thenIntersectionIsTrueUnitTest() throws Exception {
18+
public void givenRectangle1_whenIntersectWithRectangle2_thenIntersectionIsTrue() throws Exception {
1919
Geometry rectangle1 = GeometryFactoryUtil.readWKT("POLYGON ((10 10, 10 30, 30 30, 30 10, 10 10))");
2020
Geometry rectangle2 = GeometryFactoryUtil.readWKT("POLYGON ((20 20, 20 40, 40 40, 40 20, 20 20))");
2121
Assert.assertTrue(JTSOperationUtils.checkIntersect(rectangle1, rectangle2));
2222
}
2323

2424
@Test
25-
public void givenPoint_whenAddedBuffer_thenPointIsInsideTheBufferUnitTest() throws Exception {
25+
public void givenPoint_whenAddedBuffer_thenPointIsInsideTheBuffer() throws Exception {
2626
Geometry point = GeometryFactoryUtil.readWKT("POINT (10 10)");
2727
Geometry bufferArea = JTSOperationUtils.getBuffer(point, 5);
28-
Assert.assertTrue(JTSOperationUtils.isContainment(point, bufferArea));
28+
Assert.assertTrue(JTSOperationUtils.checkContainment(point, bufferArea));
2929
}
3030

3131
@Test
32-
public void givenTwoPoints_whenGetDistanceBetween_thenGetTheDistanceUnitTest() throws Exception {
32+
public void givenTwoPoints_whenGetDistanceBetween_thenGetTheDistance() throws Exception {
3333
Geometry point1 = GeometryFactoryUtil.readWKT("POINT (10 10)");
3434
Geometry point2 = GeometryFactoryUtil.readWKT("POINT (13 14)");
3535
double distance = JTSOperationUtils.getDistance(point1, point2);
@@ -39,7 +39,7 @@ public void givenTwoPoints_whenGetDistanceBetween_thenGetTheDistanceUnitTest() t
3939
}
4040

4141
@Test
42-
public void givenTwoGeometries_whenGetUnionOfBoth_thenGetTheUnionUnitTest() throws Exception {
42+
public void givenTwoGeometries_whenGetUnionOfBoth_thenGetTheUnion() throws Exception {
4343
Geometry geometry1 = GeometryFactoryUtil.readWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))");
4444
Geometry geometry2 = GeometryFactoryUtil.readWKT("POLYGON ((10 0, 10 10, 20 10, 20 0, 10 0))");
4545

@@ -49,7 +49,7 @@ public void givenTwoGeometries_whenGetUnionOfBoth_thenGetTheUnionUnitTest() thro
4949
}
5050

5151
@Test
52-
public void givenBaseRectangle_whenAnotherRectangleOverlapping_GetTheDifferenceRectangleUnitTest() throws Exception {
52+
public void givenBaseRectangle_whenAnotherRectangleOverlapping_GetTheDifferenceRectangle() throws Exception {
5353
Geometry base = GeometryFactoryUtil.readWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))");
5454
Geometry cut = GeometryFactoryUtil.readWKT("POLYGON ((5 0, 5 10, 10 10, 10 0, 5 0))");
5555

@@ -59,7 +59,7 @@ public void givenBaseRectangle_whenAnotherRectangleOverlapping_GetTheDifferenceR
5959
}
6060

6161
@Test
62-
public void givenInvalidGeometryValue_whenValidated_thenGiveFixedResultUnitTest() throws Exception {
62+
public void givenInvalidGeometryValue_whenValidated_thenGiveFixedResult() throws Exception {
6363
Geometry invalidGeo = GeometryFactoryUtil.readWKT("POLYGON ((0 0, 5 5, 5 0, 0 5, 0 0))");
6464
Geometry result = JTSOperationUtils.validateAndRepair(invalidGeo);
6565

0 commit comments

Comments
 (0)