### Question:
ResourceResolverMapTransformerFactory implements TransformerFactory { protected Attributes rebuildAttributes(final SlingHttpServletRequest slingRequest, final String elementName, final Attributes attrs) { if (slingRequest == null || !attributes.containsKey(elementName)) { return attrs; } final String[] modifiableAttributes = attributes.get(elementName); final AttributesImpl newAttrs = new AttributesImpl(attrs); final int len = newAttrs.getLength(); for (int i = 0; i < len; i++) { final String attrName = newAttrs.getLocalName(i); if (ArrayUtils.contains(modifiableAttributes, attrName)) { final String attrValue = newAttrs.getValue(i); if (StringUtils.startsWith(attrValue, "/") && !StringUtils.startsWith(attrValue, " try { final String attrValueDecoded = new URLCodec().decode(attrValue); newAttrs.setValue(i, slingRequest.getResourceResolver().map(slingRequest, attrValueDecoded)); } catch (DecoderException e) { log.error("Could not decode the attribute value", e); newAttrs.setValue(i, slingRequest.getResourceResolver().map(slingRequest, attrValue)); } } } } return newAttrs; }  Transformer createTransformer();  }### Answer:
@Test public void testRebuildAttributes() throws Exception { when(resourceResolver.map(request, "/content/site/en/jcr:content/img.png")).thenReturn("/en/jcr:content/img.png"); final Map<String, Object> config = new HashMap<String, Object>(); config.put("attributes", new String[]{"img:src"}); ResourceResolverMapTransformerFactory factory = new ResourceResolverMapTransformerFactory(); factory.activate(config); Transformer transformer = factory.createTransformer(); transformer.init(processingContext, null); transformer.setContentHandler(handler); AttributesImpl in = new AttributesImpl(); in.addAttribute(null, "src", null, "CDATA", "/content/site/en/jcr:content/img.png"); transformer.startElement(null, "img", null, in); verify(handler, only()).startElement(isNull(), eq("img"), isNull(), attributesCaptor.capture()); Attributes out = attributesCaptor.getValue(); assertEquals("/en/jcr:content/img.png", out.getValue(0)); }