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 e0988e5f2cec9b23f98d6c905419a110392a7187 Author: Alex Herbert <aherb...@apache.org> AuthorDate: Fri Apr 25 12:35:27 2025 +0100 sonar fix: refactor lambda to only one source of runtime exception --- .../geometry/euclidean/oned/AffineTransformMatrix1DTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1DTest.java index e506b3c8..80561720 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1DTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1DTest.java @@ -463,8 +463,10 @@ class AffineTransformMatrix1DTest { @Test void testApplyDirection_illegalNorm() { // act/assert - Assertions.assertThrows(IllegalArgumentException.class, () -> AffineTransformMatrix1D.createScale(0).applyDirection(Vector1D.Unit.PLUS)); - Assertions.assertThrows(IllegalArgumentException.class, () -> AffineTransformMatrix1D.createScale(2).applyDirection(Vector1D.ZERO)); + final AffineTransformMatrix1D transform = AffineTransformMatrix1D.createScale(0); + Assertions.assertThrows(IllegalArgumentException.class, () -> transform.applyDirection(Vector1D.Unit.PLUS)); + final AffineTransformMatrix1D transform2 = AffineTransformMatrix1D.createScale(0); + Assertions.assertThrows(IllegalArgumentException.class, () -> transform2.applyDirection(Vector1D.ZERO)); } @Test @@ -628,7 +630,8 @@ class AffineTransformMatrix1DTest { @Test void testNormalTransform_nonInvertible() { // act/assert - Assertions.assertThrows(IllegalStateException.class, () -> AffineTransformMatrix1D.createScale(0).normalTransform()); + final AffineTransformMatrix1D transform = AffineTransformMatrix1D.createScale(0); + Assertions.assertThrows(IllegalStateException.class, () -> transform.normalTransform()); } @Test