@Override
    public int read(char[] cbuf, int off, int len) throws IOException {
        int read = in.read(cbuf, off, len);
        if (read > 0) {
            nonXmlCharFilterer.filter(cbuf, off, read);
        }
        return read;
    }
@Test
    public void testRead() throws IOException {
        char[] buffer = new char[10];

        when(readerMock.read(same(buffer), eq(3), eq(5))).thenAnswer(new Answer<Integer>() {

            public Integer answer(InvocationOnMock invocation) throws Throwable {
                try (ConstantReader reader = new ConstantReader(new char[] { 'a', 'b', 'c' })) {
                    Object[] args = invocation.getArguments();
                    return reader.read((char[]) args[0], (Integer) args[1], (Integer) args[2]);
                }
            }
        });

        int result = nonXmlFilterReader.read(buffer, 3, 5);

        verify(readerMock).read(same(buffer), eq(3), eq(5));
        verify(nonXmlCharFiltererMock).filter(same(buffer), eq(3), eq(3));

        assertEquals(3, result, "Unexpected number of chars read");
        assertArrayEquals(new char[] { 0, 0, 0, 'a', 'b', 'c', 0, 0, 0, 0 }, buffer, "Wrong buffer contents");
    }