mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 22:43:30 +08:00

* fixed error and changed functions names fixed error at line 57 and gave semantic names to functions with comments * renamed functions renamed functions to match with original functions' names in the file * Updated TestCases Updated TestCases and changed a function name * Removed main() and changed function name Removed main() and changed the function name from isPalindromeStringBuilder to isPalindrome * fixed typo Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
27 lines
781 B
Java
27 lines
781 B
Java
package com.thealgorithms.strings;
|
|
|
|
import org.junit.jupiter.api.Assertions;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
public class PalindromeTest {
|
|
|
|
@Test
|
|
public void palindrome() {
|
|
|
|
String[] palindromes = { null, "", "aba", "123321", "kayak" };
|
|
for (String s : palindromes) {
|
|
Assertions.assertTrue(Palindrome.isPalindrome(s) &&
|
|
Palindrome.isPalindromeRecursion(s) &&
|
|
Palindrome.isPalindromeTwoPointer(s));
|
|
}
|
|
|
|
String[] notPalindromes = { "abb", "abc", "abc123", "kayaks" };
|
|
for (String s : notPalindromes) {
|
|
Assertions.assertFalse(Palindrome.isPalindrome(s) ||
|
|
Palindrome.isPalindromeRecursion(s) ||
|
|
Palindrome.isPalindromeTwoPointer(s));
|
|
}
|
|
|
|
}
|
|
}
|