Fix NumberUtilsTest#testMaxDouble() and testMaxFloat()#1506
Fix NumberUtilsTest#testMaxDouble() and testMaxFloat()#1506garydgregory merged 3 commits intoapache:masterfrom
Conversation
| @Test | ||
| void testMaxDouble_nullArray() { | ||
| assertNullPointerException(() -> NumberUtils.max((double[]) null)); | ||
| assertNullPointerException(() -> NumberUtils.max((double[]) null), "No exception was thrown for null input."); |
There was a problem hiding this comment.
No need for this extra message IMO, it doesn't help more than the actual assert.
| void testMaxDouble_emptyArray() { | ||
| assertIllegalArgumentException(NumberUtils::max); | ||
| final double[] d = new double[0]; | ||
| assertIllegalArgumentException(() -> NumberUtils.max(d), "No exception was thrown for empty input."); |
There was a problem hiding this comment.
No need to clutter things up.
There was a problem hiding this 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.
|
@garydgregory, |
Corrected tests related to getMax in NumberUtilsTest