mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 22:43:30 +08:00
Code refactor for AbsoluteMax improvements (#3020)
Fix #3019 Co-authored-by: Yang Libin <szuyanglb@outlook.com>
This commit is contained in:
21
src/test/java/com/thealgorithms/maths/AbsoluteMaxTest.java
Normal file
21
src/test/java/com/thealgorithms/maths/AbsoluteMaxTest.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class AbsoluteMaxTest {
|
||||
|
||||
@Test
|
||||
void testGetMaxValue() {
|
||||
assertEquals(16, AbsoluteMax.getMaxValue(-2, 0, 16));
|
||||
assertEquals(-10, AbsoluteMax.getMaxValue(3, -10, -2));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetMaxValueWithNoArguments() {
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, () -> AbsoluteMax.getMaxValue());
|
||||
assertEquals("Numbers array cannot be empty", exception.getMessage());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user