- Notifications
You must be signed in to change notification settings - Fork 19.9k
/
Copy pathAbsoluteMinTest.java
27 lines (21 loc) · 821 Bytes
/
AbsoluteMinTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
packagecom.thealgorithms.maths;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
importstaticorg.junit.jupiter.api.Assertions.assertThrows;
importorg.junit.jupiter.api.Test;
publicclassAbsoluteMinTest {
@Test
voidtestGetMinValue() {
assertEquals(0, AbsoluteMin.getMinValue(4, 0, 16));
assertEquals(-2, AbsoluteMin.getMinValue(3, -10, -2));
}
@Test
voidtestGetMinValueWithNoArguments() {
Exceptionexception = assertThrows(IllegalArgumentException.class, AbsoluteMin::getMinValue);
assertEquals("Numbers array cannot be empty", exception.getMessage());
}
@Test
voidtestGetMinValueWithSameAbsoluteValues() {
assertEquals(-5, AbsoluteMin.getMinValue(-5, 5));
assertEquals(-5, AbsoluteMin.getMinValue(5, -5));
}
}