Code refactor for AbsoluteMin improvements (#3022)

Fix #3021
This commit is contained in:
Cristiano Jesus
2022-04-20 09:12:55 +01:00
committed by GitHub
parent 719e1d8132
commit 02375e0683
2 changed files with 41 additions and 24 deletions

View 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 AbsoluteMinTest {
@Test
void testGetMinValue() {
assertEquals(0, AbsoluteMin.getMinValue(4, 0, 16));
assertEquals(-2, AbsoluteMin.getMinValue(3, -10, -2));
}
@Test
void testGetMinValueWithNoArguments() {
Exception exception = assertThrows(IllegalArgumentException.class, () -> AbsoluteMin.getMinValue());
assertEquals("Numbers array cannot be empty", exception.getMessage());
}
}