mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 06:55:02 +08:00
Update AbsoluteMax (#4140)
This commit is contained in:
@ -10,15 +10,12 @@ public class AbsoluteMaxTest {
|
||||
@Test
|
||||
void testGetMaxValue() {
|
||||
assertEquals(16, AbsoluteMax.getMaxValue(-2, 0, 16));
|
||||
assertEquals(-10, AbsoluteMax.getMaxValue(3, -10, -2));
|
||||
assertEquals(-22, AbsoluteMax.getMaxValue(-3, -10, -22));
|
||||
assertEquals(-888, AbsoluteMax.getMaxValue(-888));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetMaxValueWithNoArguments() {
|
||||
Exception exception = assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> AbsoluteMax.getMaxValue()
|
||||
);
|
||||
assertEquals("Numbers array cannot be empty", exception.getMessage());
|
||||
assertThrows(IllegalArgumentException.class, AbsoluteMax::getMaxValue);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user