ReverseString { public String reverseRecursive(String input) { validateInput(input); return reverseRecursiveInner(input, input.length() - 1, new StringBuilder()); }  String reverseIterative(String input); String reverseRecursive(String input);  }
@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullStringsRecursive() { reverseString.reverseRecursive(null); }
@Test public void shouldReturnAnEmptyStringIfTheInputIsEmptyRecursive() { String result = reverseString.reverseRecursive(""); assertEquals("", result); }
@Test public void shouldReturnTheSameStringIfTheInputStringContainsJustOneCharRecursive() { String result = reverseString.reverseRecursive("a"); assertEquals("a", result); }
@Test public void shouldReverseStringRecursive() { String result = reverseString.reverseRecursive("Pedro"); assertEquals("ordeP", result); }