Method to check if a string is a palindrome. With unit tests.