This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git

commit be8ea03fa49632a3bcff46b9b7cfa805e94be52b
Author: Alex Herbert <aherb...@apache.org>
AuthorDate: Fri Apr 25 12:15:51 2025 +0100

    sonar fix: use method reference
---
 .../geometry/core/collection/PointMapTestBase.java   | 20 ++++++++++----------
 .../geometry/core/collection/PointSetTestBase.java   | 16 ++++++++--------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git 
a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/collection/PointMapTestBase.java
 
b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/collection/PointMapTestBase.java
index 8ec3c214..97f9548b 100644
--- 
a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/collection/PointMapTestBase.java
+++ 
b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/collection/PointMapTestBase.java
@@ -847,14 +847,14 @@ public abstract class PointMapTestBase<P extends Point<P>>
         final Iterator<Map.Entry<P, Integer>> it = 
map.entriesNearToFar(pts.get(0)).iterator();
         Assertions.assertTrue(it.hasNext());
         Assertions.assertEquals(new SimpleEntry<>(pts.get(0), 0), it.next());
-        Assertions.assertThrows(UnsupportedOperationException.class, () -> 
it.remove());
+        Assertions.assertThrows(UnsupportedOperationException.class, 
it::remove);
 
         Assertions.assertTrue(it.hasNext());
         Assertions.assertEquals(new SimpleEntry<>(pts.get(1), 1), it.next());
 
         Assertions.assertFalse(it.hasNext());
 
-        Assertions.assertThrows(NoSuchElementException.class, () -> it.next());
+        Assertions.assertThrows(NoSuchElementException.class, it::next);
     }
 
     @Test
@@ -870,7 +870,7 @@ public abstract class PointMapTestBase<P extends Point<P>>
         map.remove(pts.get(0));
 
         // assert
-        Assertions.assertThrows(ConcurrentModificationException.class, () -> 
it.next());
+        Assertions.assertThrows(ConcurrentModificationException.class, 
it::next);
     }
 
     @Test
@@ -961,14 +961,14 @@ public abstract class PointMapTestBase<P extends Point<P>>
         final Iterator<Map.Entry<P, Integer>> it = 
map.entriesFarToNear(pts.get(0)).iterator();
         Assertions.assertTrue(it.hasNext());
         Assertions.assertEquals(new SimpleEntry<>(pts.get(1), 1), it.next());
-        Assertions.assertThrows(UnsupportedOperationException.class, () -> 
it.remove());
+        Assertions.assertThrows(UnsupportedOperationException.class, 
it::remove);
 
         Assertions.assertTrue(it.hasNext());
         Assertions.assertEquals(new SimpleEntry<>(pts.get(0), 0), it.next());
 
         Assertions.assertFalse(it.hasNext());
 
-        Assertions.assertThrows(NoSuchElementException.class, () -> it.next());
+        Assertions.assertThrows(NoSuchElementException.class, it::next);
     }
 
     @Test
@@ -984,7 +984,7 @@ public abstract class PointMapTestBase<P extends Point<P>>
         map.remove(pts.get(0));
 
         // assert
-        Assertions.assertThrows(ConcurrentModificationException.class, () -> 
it.next());
+        Assertions.assertThrows(ConcurrentModificationException.class, 
it::next);
     }
 
     @Test
@@ -1881,7 +1881,7 @@ public abstract class PointMapTestBase<P extends Point<P>>
         Assertions.assertNotNull(it.next());
 
         Assertions.assertFalse(it.hasNext());
-        Assertions.assertThrows(NoSuchElementException.class, () -> it.next());
+        Assertions.assertThrows(NoSuchElementException.class, it::next);
     }
 
     private void assertCollectionIteratorRemove(final Function<PointMap<P, ?>, 
Collection<?>> collectionFactory) {
@@ -1965,7 +1965,7 @@ public abstract class PointMapTestBase<P extends Point<P>>
         // act/assert
         final Iterator<?> it = coll.iterator();
 
-        Assertions.assertThrows(IllegalStateException.class, () -> 
it.remove());
+        Assertions.assertThrows(IllegalStateException.class, it::remove);
     }
 
     private void assertCollectionIteratorRemoveMultipleCalls(
@@ -1981,7 +1981,7 @@ public abstract class PointMapTestBase<P extends Point<P>>
         Assertions.assertNotNull(it.next());
         it.remove();
 
-        Assertions.assertThrows(IllegalStateException.class, () -> 
it.remove());
+        Assertions.assertThrows(IllegalStateException.class, it::remove);
 
         Assertions.assertEquals(0, map.size());
     }
@@ -2003,7 +2003,7 @@ public abstract class PointMapTestBase<P extends Point<P>>
 
         // assert
         Assertions.assertTrue(it.hasNext());
-        Assertions.assertThrows(ConcurrentModificationException.class, () -> 
it.next());
+        Assertions.assertThrows(ConcurrentModificationException.class, 
it::next);
     }
 
     /** Assert that {@code collection} returns entries with the same keys in 
the same order as
diff --git 
a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/collection/PointSetTestBase.java
 
b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/collection/PointSetTestBase.java
index fcea2f05..2b68c9de 100644
--- 
a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/collection/PointSetTestBase.java
+++ 
b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/collection/PointSetTestBase.java
@@ -542,7 +542,7 @@ public abstract class PointSetTestBase<P extends Point<P>>
         Assertions.assertEquals(0, testPts.size(), "Expected iterator to visit 
all points");
 
         Assertions.assertFalse(it.hasNext());
-        Assertions.assertThrows(NoSuchElementException.class, () -> it.next());
+        Assertions.assertThrows(NoSuchElementException.class, it::next);
     }
 
     @Test
@@ -555,7 +555,7 @@ public abstract class PointSetTestBase<P extends Point<P>>
 
         // assert
         Assertions.assertFalse(it.hasNext());
-        Assertions.assertThrows(NoSuchElementException.class, () -> it.next());
+        Assertions.assertThrows(NoSuchElementException.class, it::next);
     }
 
     @Test
@@ -877,14 +877,14 @@ public abstract class PointSetTestBase<P extends Point<P>>
         final Iterator<P> it = set.nearToFar(pts.get(0)).iterator();
         Assertions.assertTrue(it.hasNext());
         Assertions.assertEquals(pts.get(0), it.next());
-        Assertions.assertThrows(UnsupportedOperationException.class, () -> 
it.remove());
+        Assertions.assertThrows(UnsupportedOperationException.class, 
it::remove);
 
         Assertions.assertTrue(it.hasNext());
         Assertions.assertEquals(pts.get(1), it.next());
 
         Assertions.assertFalse(it.hasNext());
 
-        Assertions.assertThrows(NoSuchElementException.class, () -> it.next());
+        Assertions.assertThrows(NoSuchElementException.class, it::next);
     }
 
     @Test
@@ -900,7 +900,7 @@ public abstract class PointSetTestBase<P extends Point<P>>
         set.remove(pts.get(0));
 
         // assert
-        Assertions.assertThrows(ConcurrentModificationException.class, () -> 
it.next());
+        Assertions.assertThrows(ConcurrentModificationException.class, 
it::next);
     }
 
     @Test
@@ -987,14 +987,14 @@ public abstract class PointSetTestBase<P extends Point<P>>
         final Iterator<P> it = set.farToNear(pts.get(0)).iterator();
         Assertions.assertTrue(it.hasNext());
         Assertions.assertEquals(pts.get(1), it.next());
-        Assertions.assertThrows(UnsupportedOperationException.class, () -> 
it.remove());
+        Assertions.assertThrows(UnsupportedOperationException.class, 
it::remove);
 
         Assertions.assertTrue(it.hasNext());
         Assertions.assertEquals(pts.get(0), it.next());
 
         Assertions.assertFalse(it.hasNext());
 
-        Assertions.assertThrows(NoSuchElementException.class, () -> it.next());
+        Assertions.assertThrows(NoSuchElementException.class, it::next);
     }
 
     @Test
@@ -1010,7 +1010,7 @@ public abstract class PointSetTestBase<P extends Point<P>>
         set.remove(pts.get(0));
 
         // assert
-        Assertions.assertThrows(ConcurrentModificationException.class, () -> 
it.next());
+        Assertions.assertThrows(ConcurrentModificationException.class, 
it::next);
     }
 
     @Test

Reply via email to