PropertyReplacementFilter extends StreamReaderDelegate { @Override public String getAttributeValue(int index) { return this.replace(super.getAttributeValue(index)); } 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 getAttributeValue() { String expected = "expected"; int index = 10; when(this.reader.getAttributeValue(index)).thenReturn(expected); String result = this.filter.getAttributeValue(index); assertSame(expected, result); when(this.reader.getAttributeValue(index)).thenReturn(SYSTEM_PROPERTY); result = this.filter.getAttributeValue(index); assertEquals(PROPERTY_VALUE, result); }
@Test public void getAttributeValueByName() { String namespaceURI = "url"; String localName = "name"; String expected = "expected"; when(this.reader.getAttributeValue(namespaceURI, localName)).thenReturn(expected); String result = this.filter.getAttributeValue(namespaceURI, localName); assertSame(expected, result); when(this.reader.getAttributeValue(namespaceURI, localName)).thenReturn(SYSTEM_PROPERTY); result = this.filter.getAttributeValue(namespaceURI, localName); assertEquals(PROPERTY_VALUE, result); }