@Test
public void testRead() throws IOException {

    Reader reader = new StringReader(source);
    CharToSpaceReader mapReader = new CharToSpaceReader(reader, chars);
    try {
        for (int i = 0; i < expected.length(); i++) {
            char c = expected.charAt(i);
            char read = (char) mapReader.read();
            assertEquals("Expected to get " + c + " at position " + i + " but got " + read, c, read);
        }
        assertEquals(-1, mapReader.read());
    } finally {
        mapReader.close();
    }
}