- Notifications
You must be signed in to change notification settings - Fork 19.9k
/
Copy pathLongestPalindromicSubstringTest.java
21 lines (16 loc) · 866 Bytes
/
LongestPalindromicSubstringTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
packagecom.thealgorithms.strings;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
importjava.util.stream.Stream;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.Arguments;
importorg.junit.jupiter.params.provider.MethodSource;
classLongestPalindromicSubstringTest {
@ParameterizedTest
@MethodSource("provideTestCasesForLongestPalindrome")
voidtestLongestPalindrome(Stringinput, Stringexpected) {
assertEquals(expected, LongestPalindromicSubstring.longestPalindrome(input));
}
privatestaticStream<Arguments> provideTestCasesForLongestPalindrome() {
returnStream.of(Arguments.of("babad", "bab"), Arguments.of("cbbd", "bb"), Arguments.of("a", "a"), Arguments.of("", ""), Arguments.of("abc", "a"), Arguments.of(null, ""), Arguments.of("aaaaa", "aaaaa"));
}
}