TheRealHaui commented on code in PR #1506:
URL: https://github.com/apache/commons-lang/pull/1506#discussion_r2572201159


##########
src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java:
##########
@@ -1205,21 +1205,17 @@ void testMaxByte_nullArray() {
 
     @Test
     void testMaxDouble() {
-        final double[] d = null;
-        assertNullPointerException(() -> NumberUtils.max(d), "No exception was 
thrown for null input.");
-
-        assertIllegalArgumentException(NumberUtils::max, "No exception was 
thrown for empty input.");
-
-        assertEquals(5.1f, NumberUtils.max(5.1f), "max(double[]) failed for 
array length 1");
-        assertEquals(9.2f, NumberUtils.max(6.3f, 9.2f), "max(double[]) failed 
for array length 2");
-        assertEquals(10.4f, NumberUtils.max(-10.5f, -5.6f, 0, 5.7f, 10.4f), 
"max(double[]) failed for float length 5");
-        assertEquals(10, NumberUtils.max(-10, -5, 0, 5, 10), 0.0001);
-        assertEquals(10, NumberUtils.max(-5, 0, 10, 5, -10), 0.0001);
+        assertEquals(5.1d, NumberUtils.max(5.1d), "max(double[]) failed for 
array length 1");
+        assertEquals(9.2d, NumberUtils.max(6.3d, 9.2d), "max(double[]) failed 
for array length 2");
+        assertEquals(10.4d, NumberUtils.max(-10.5d, -5.6d, 0, 5.7d, 10.4d), 
"max(double[]) failed for double length 5");
+        assertEquals(10d, NumberUtils.max(-10d, -5d, 0d, 5d, 10d));
+        assertEquals(10d, NumberUtils.max(-5d, 0d, 10d, 5d, -10d));
     }
 
     @Test
     void testMaxDouble_emptyArray() {
-        assertIllegalArgumentException(NumberUtils::max);
+        final double[] d = new double[0];
+        assertIllegalArgumentException(() -> NumberUtils.max(d), "No exception 
was thrown for empty input.");

Review Comment:
   @garydgregory,
   the reason why I changed it and/or propose to change it is the pattern of 
the tests or better test names in the NumberUtilsTest class. 
   The name of the test - testMaxDouble_emptyArray - imposes that method 
"public static double max(final double... array) ..." gets called.
   However, because of the used Lamba/method reference "NumberUtils::max" 
actually "public static byte max(final byte... array) ..." gets called.
   
   Don't get me wrong I do NOT want to be super picky or appear super-smart!
   Just want to explain why I proposed to change it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to