forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReverseNumberTest.java
More file actions
23 lines (18 loc) · 823 Bytes
/
ReverseNumberTest.java
File metadata and controls
23 lines (18 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.thealgorithms.maths;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
public class ReverseNumberTest {
@ParameterizedTest
@CsvSource({"0, 0", "1, 1", "10, 1", "123, 321", "7890, 987"})
public void testReverseNumber(int input, int expected) {
assertEquals(expected, ReverseNumber.reverseNumber(input));
}
@ParameterizedTest
@ValueSource(ints = {-1, -123, -7890})
public void testReverseNumberThrowsExceptionForNegativeInput(int input) {
assertThrows(IllegalArgumentException.class, () -> ReverseNumber.reverseNumber(input));
}
}