@Test
public void testReadCharBuffer() throws IOException {

    Reader reader = new StringReader(source);
    CharToSpaceReader mapReader = new CharToSpaceReader(reader, chars);
    try {
        CharBuffer buffer = CharBuffer.allocate(expected.length());
        int numRead = mapReader.read(buffer);
        assertEquals(expected.length(), numRead);
        for (int i = 0; i < expected.toCharArray().length; i++) {
            assertEquals(expected.charAt(i), buffer.get(i));
        }
    } finally {
        mapReader.close();
    }
}