- Notifications
You must be signed in to change notification settings - Fork 19.9k
/
Copy pathReverseNumberTest.java
23 lines (18 loc) · 823 Bytes
/
ReverseNumberTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
packagecom.thealgorithms.maths;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
importstaticorg.junit.jupiter.api.Assertions.assertThrows;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.CsvSource;
importorg.junit.jupiter.params.provider.ValueSource;
publicclassReverseNumberTest {
@ParameterizedTest
@CsvSource({"0, 0", "1, 1", "10, 1", "123, 321", "7890, 987"})
publicvoidtestReverseNumber(intinput, intexpected) {
assertEquals(expected, ReverseNumber.reverseNumber(input));
}
@ParameterizedTest
@ValueSource(ints = {-1, -123, -7890})
publicvoidtestReverseNumberThrowsExceptionForNegativeInput(intinput) {
assertThrows(IllegalArgumentException.class, () -> ReverseNumber.reverseNumber(input));
}
}