Skip to content

Commit 7e0cc1e

Browse files
TheRealHauiTheRealHauigarydgregory
authored
Fix NumberUtilsTest#testMaxDouble() and testMaxFloat() (#1506)
* Corrected NumberUtilsTest#getMax... tests * No need for extra message in this case * No need to clutter things up --------- Co-authored-by: TheRealHaui <[email protected]> Co-authored-by: Gary Gregory <[email protected]>
1 parent 97caf74 commit 7e0cc1e

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,16 +1205,11 @@ void testMaxByte_nullArray() {
12051205

12061206
@Test
12071207
void testMaxDouble() {
1208-
final double[] d = null;
1209-
assertNullPointerException(() -> NumberUtils.max(d), "No exception was thrown for null input.");
1210-
1211-
assertIllegalArgumentException(NumberUtils::max, "No exception was thrown for empty input.");
1212-
1213-
assertEquals(5.1f, NumberUtils.max(5.1f), "max(double[]) failed for array length 1");
1214-
assertEquals(9.2f, NumberUtils.max(6.3f, 9.2f), "max(double[]) failed for array length 2");
1215-
assertEquals(10.4f, NumberUtils.max(-10.5f, -5.6f, 0, 5.7f, 10.4f), "max(double[]) failed for float length 5");
1216-
assertEquals(10, NumberUtils.max(-10, -5, 0, 5, 10), 0.0001);
1217-
assertEquals(10, NumberUtils.max(-5, 0, 10, 5, -10), 0.0001);
1208+
assertEquals(5.1d, NumberUtils.max(5.1d), "max(double[]) failed for array length 1");
1209+
assertEquals(9.2d, NumberUtils.max(6.3d, 9.2d), "max(double[]) failed for array length 2");
1210+
assertEquals(10.4d, NumberUtils.max(-10.5d, -5.6d, 0, 5.7d, 10.4d), "max(double[]) failed for double length 5");
1211+
assertEquals(10d, NumberUtils.max(-10d, -5d, 0d, 5d, 10d));
1212+
assertEquals(10d, NumberUtils.max(-5d, 0d, 10d, 5d, -10d));
12181213
}
12191214

12201215
@Test
@@ -1232,8 +1227,8 @@ void testMaxFloat() {
12321227
assertEquals(5.1f, NumberUtils.max(5.1f), "max(float[]) failed for array length 1");
12331228
assertEquals(9.2f, NumberUtils.max(6.3f, 9.2f), "max(float[]) failed for array length 2");
12341229
assertEquals(10.4f, NumberUtils.max(-10.5f, -5.6f, 0, 5.7f, 10.4f), "max(float[]) failed for float length 5");
1235-
assertEquals(10, NumberUtils.max(-10, -5, 0, 5, 10), 0.0001f);
1236-
assertEquals(10, NumberUtils.max(-5, 0, 10, 5, -10), 0.0001f);
1230+
assertEquals(10f, NumberUtils.max(-10f, -5f, 0f, 5f, 10f), 0.0001f);
1231+
assertEquals(10f, NumberUtils.max(-5f, 0f, 10f, 5f, -10f), 0.0001f);
12371232
}
12381233

12391234
@Test

0 commit comments

Comments
 (0)