Palindromes { public boolean evaluate(String word) { if (word == null) { throw new IllegalArgumentException("You can't pass a null String as input."); } boolean result = true; int length = word.length(); for (int i = 0; i < length / 2; i++) { if (word.charAt(i) != word.charAt(length - 1 - i)) { result = false; break; } } return result; }  boolean evaluate(String word);  }
@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullStrings(){ palindromes.evaluate(null); }
@Test public void shouldReturnTrueIfInputStringIsEmpty(){ assertTrue(palindromes.evaluate("")); }
@Test public void shouldReturnFalseIfInputIsPalindrome(){ assertFalse(palindromes.evaluate("pedro")); }
@Test public void shouldReturnTrueIfInputIsPalindrome(){ assertTrue(palindromes.evaluate("ana")); }