- Notifications
You must be signed in to change notification settings - Fork 19.9k
/
Copy pathPalindromeTest.java
21 lines (17 loc) · 971 Bytes
/
PalindromeTest.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;
importjava.util.stream.Stream;
importorg.junit.jupiter.api.Assertions;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.MethodSource;
publicclassPalindromeTest {
privatestaticStream<TestData> provideTestCases() {
returnStream.of(newTestData(null, true), newTestData("", true), newTestData("aba", true), newTestData("123321", true), newTestData("kayak", true), newTestData("abb", false), newTestData("abc", false), newTestData("abc123", false), newTestData("kayaks", false));
}
@ParameterizedTest
@MethodSource("provideTestCases")
voidtestPalindrome(TestDatatestData) {
Assertions.assertEquals(testData.expected, Palindrome.isPalindrome(testData.input) && Palindrome.isPalindromeRecursion(testData.input) && Palindrome.isPalindromeTwoPointer(testData.input));
}
privaterecordTestData(Stringinput, booleanexpected) {
}
}