Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 21.3k
Expand file tree
/
Copy pathOctalToDecimalTest.java
More file actions
Latest commit
21 lines (17 loc) · 1.02 KB
/
Copy pathOctalToDecimalTest.java
File metadata and controls
21 lines (17 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
packagecom.thealgorithms.conversions;
importorg.junit.jupiter.api.Assertions;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.CsvSource;
publicclassOctalToDecimalTest {
@ParameterizedTest
@CsvSource({"10, 8", "7, 7", "77, 63", "123, 83", "0, 0", "777, 511", "2671, 1465", "275, 189"})
voidtestConvertOctalToDecimal(StringinputOctal, intexpectedDecimal) {
Assertions.assertEquals(expectedDecimal, OctalToDecimal.convertOctalToDecimal(inputOctal));
}
@ParameterizedTest
@CsvSource({"'', Input cannot be null or empty", "'8', Incorrect input: Expecting an octal number (digits 0-7)", "'19', Incorrect input: Expecting an octal number (digits 0-7)"})
voidtestIncorrectInput(StringinputOctal, StringexpectedMessage) {
IllegalArgumentExceptionexception = Assertions.assertThrows(IllegalArgumentException.class, () -> OctalToDecimal.convertOctalToDecimal(inputOctal));
Assertions.assertEquals(expectedMessage, exception.getMessage());
}
}