public boolean filter(char[] content, int offset, int length) {
        if (content == null) {
            return false;
        }

        boolean filtered = false;
        for (int i = offset; i < offset + length; i++) {
            if (isFiltered(content[i])) {
                filtered = true;
                content[i] = REPLACEMENT_CHAR;
            }
        }

        if (filtered) {
            LOG.warn("Identified and replaced non-XML chars");
        }

        return filtered;
    }
@Test
    public void testFilter1ArgFiltered() {
        when(nonXmlCharFiltererMock.filter(anyString())).thenCallRealMethod();
        when(nonXmlCharFiltererMock.filter(eq(new char[] { 'a', 'b', 'c' }), anyInt(), anyInt()))
                .thenAnswer(new Answer<Boolean>() {

                    public Boolean answer(InvocationOnMock invocation) {
                        char[] buffer = (char[]) invocation.getArguments()[0];
                        buffer[0] = 'i';
                        buffer[1] = 'o';
                        return true;
                    }
                });

        String result = nonXmlCharFiltererMock.filter("abc");
        verify(nonXmlCharFiltererMock).filter(any(char[].class), eq(0), eq(3));
        assertEquals("ioc", result, "Should have returned filtered string");
    }