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 pathPalindromeTest.java
More file actions
Latest commit
21 lines (17 loc) · 971 Bytes
/
Copy pathPalindromeTest.java
File metadata and controls
21 lines (17 loc) · 971 Bytes
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) {
}
}