### Question:
StringReader extends Reader { @Override public int read() { if (str == null) throw new IOException("Reader is closed"); if (pos == count) return -1; return str.charAt(pos++); } StringReader(String str); @Override void close(); @Override int read(); @Override int read(char[] buf, int offset, int length);  }### Answer:
@Test public void testRead() { String initialData = "Test String"; StringReader sut = new StringReader(initialData); int currentChar; char[] line = new char[11]; int index = -1; while ((currentChar = sut.read()) != -1) { line[++index] = (char) currentChar; } String output = new String(line); assertEquals(initialData, output); sut.close(); }