### Question:
Spelling { String addCharAt(String word, int pos, char ch) { int c = 0; int d = 0; char[] e = new char[word.length() + 1]; while (c < word.length()) { if (c == pos) { e[d++] = ch; } e[d++] = word.charAt(c++); } if (pos == word.length()) { e[d] = ch; } return new String(e); } Spelling(InputStream file);   }### Answer:
@Test public void testAdd() throws Exception { assertEquals("afarm", spelling.addCharAt("farm", 0, 'a')); assertEquals("faarm", spelling.addCharAt("farm", 1, 'a')); assertEquals("faarm", spelling.addCharAt("farm", 2, 'a')); assertEquals("faram", spelling.addCharAt("farm", 3, 'a')); assertEquals("farma", spelling.addCharAt("farm", 4, 'a')); }