forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlphabeticalTest.java
More file actions
30 lines (25 loc) · 906 Bytes
/
AlphabeticalTest.java
File metadata and controls
30 lines (25 loc) · 906 Bytes
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
28
29
30
package com.thealgorithms.strings;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
public class AlphabeticalTest {
@ParameterizedTest(name = "\"{0}\" → Expected: {1}")
@CsvSource({
"'abcdefghijklmno', true",
"'abcdxxxyzzzz', true",
"'123a', false",
"'abcABC', false",
"'abcdefghikjlmno', false",
"'aBC', true",
"'abc', true",
"'xyzabc', false",
"'abcxyz', true",
"'', false",
"'1', false",
"'abc!', false", // <-- missing coverage
"'ABc1', false" // <-- optional extra
})
void testIsAlphabetical(String input, boolean expected) {
assertEquals(expected, Alphabetical.isAlphabetical(input));
}
}