Added a method and JUnit test case to replace a character in a string