PropertyReplacementFilter extends StreamReaderDelegate { @Override public char[] getTextCharacters() { return this.replace(String.valueOf(super.getTextCharacters())).toCharArray(); } PropertyReplacementFilter(XMLStreamReader reader);  PropertyReplacementFilter(XMLStreamReader reader, Properties properties); @Override String getAttributeValue(int index); @Override String getAttributeValue(String namespaceUri, String localName); @Override String getElementText(); @Override String getText(); @Override char[] getTextCharacters(); @Override int getTextCharacters(int sourceStart, char[] target, int targetStart, int length);  }
@Test public void getTextCharacters() { char[] expected = "expected".toCharArray(); when(this.reader.getTextCharacters()).thenReturn(expected); char[] result = this.filter.getTextCharacters(); assertArrayEquals(expected, result); when(this.reader.getTextCharacters()).thenReturn(String.format("Expect the un%s!", SYSTEM_PROPERTY).toCharArray()); result = this.filter.getTextCharacters(); assertArrayEquals("Expect the unexpected!".toCharArray(), result); }