|
1 | | -package com.thealgorithms.maths; |
2 | | - |
3 | | -import static org.junit.jupiter.api.Assertions.assertEquals; |
4 | | -import static org.junit.jupiter.api.Assertions.assertThrows; |
5 | | - |
6 | | -import org.junit.jupiter.api.Test; |
7 | | - |
8 | | -public class AbsoluteMinTest { |
9 | | - |
| 1 | +package com.thealgorithms.maths; |
| 2 | + |
| 3 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 4 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
| 5 | + |
| 6 | +import org.junit.jupiter.api.Test; |
| 7 | + |
| 8 | +public class AbsoluteMinTest { |
| 9 | + |
10 | 10 | @Test |
11 | 11 | void testGetMinValue() { |
| 12 | + assertEquals(2, AbsoluteMin.getMinValue(-5, 2)); |
12 | 13 | assertEquals(0, AbsoluteMin.getMinValue(4, 0, 16)); |
13 | 14 | assertEquals(-2, AbsoluteMin.getMinValue(3, -10, -2)); |
14 | | - } |
15 | | - |
16 | | - @Test |
17 | | - void testGetMinValueWithNoArguments() { |
18 | | - Exception exception = assertThrows(IllegalArgumentException.class, AbsoluteMin::getMinValue); |
19 | | - assertEquals("Numbers array cannot be empty", exception.getMessage()); |
20 | | - } |
21 | | - |
22 | | - @Test |
| 15 | + assertEquals(-2, AbsoluteMin.getMinValue(-5, -2)); |
| 16 | + assertEquals(2, AbsoluteMin.getMinValue(5, 2)); |
| 17 | + } |
| 18 | + |
| 19 | + @Test |
| 20 | + void testGetMinValueWithNoArguments() { |
| 21 | + Exception exception = assertThrows(IllegalArgumentException.class, AbsoluteMin::getMinValue); |
| 22 | + assertEquals("Numbers array cannot be empty", exception.getMessage()); |
| 23 | + } |
| 24 | + |
| 25 | + @Test |
23 | 26 | void testGetMinValueWithSameAbsoluteValues() { |
| 27 | + assertEquals(-3, AbsoluteMin.getMinValue(-3, 3)); |
24 | 28 | assertEquals(-5, AbsoluteMin.getMinValue(-5, 5)); |
25 | 29 | assertEquals(-5, AbsoluteMin.getMinValue(5, -5)); |
26 | 30 | } |
|
0 commit comments