### Eclipse Workspace Patch 1.0
#P platform
Index: core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/internal/UserAvatarMockDocumentAccessBridge.java
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/internal/UserAvatarMockDocumentAccessBridge.java	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/internal/UserAvatarMockDocumentAccessBridge.java	(revision 0)
@@ -0,0 +1,134 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.rendering.internal;
+
+import org.xwiki.bridge.DocumentAccessBridge;
+import org.xwiki.component.descriptor.ComponentDescriptor;
+import org.xwiki.component.descriptor.DefaultComponentDescriptor;
+
+/**
+ * Mock {@link DocumentAccessBridge} implementation used for testing, since we don't want to pull any dependency on the
+ * Model/Skin/etc for the Rendering module's unit tests.
+ * 
+ * @version $Id: MockVelocityManager.java 10176 2008-06-09 16:11:28Z vmassol $
+ * @since 1.6M1
+ */
+public class UserAvatarMockDocumentAccessBridge implements DocumentAccessBridge
+{
+    /**
+     * Create and return a descriptor for this component.
+     * 
+     * @return the descriptor of the component.
+     */
+    public static ComponentDescriptor getComponentDescriptor()
+    {
+        DefaultComponentDescriptor componentDescriptor = new DefaultComponentDescriptor();
+
+        componentDescriptor.setRole(DocumentAccessBridge.ROLE);
+        componentDescriptor.setRoleHint("default");
+        componentDescriptor.setImplementation(UserAvatarMockDocumentAccessBridge.class.getName());
+
+        return componentDescriptor;
+    }
+
+    public String getDocumentContent(String documentName) throws Exception
+    {
+        return "Some content";
+    }
+
+    public String getDocumentContent(String documentName, String language) throws Exception
+    {
+        return "Some translated content";
+    }
+
+    public boolean exists(String documentName) throws Exception
+    {
+        return documentName.equals("Space.ExistingPage");
+    }
+
+    public String getURL(String documentName, String action, String queryString, String anchor) throws Exception
+    {
+        String result = "/xwiki/bin/view/" + (documentName == null ? "currentdoc" : documentName.replace(".", "/"));
+        if (anchor != null) {
+            result = result + "#" + anchor;
+        }
+        if (queryString != null) {
+            result = result + "?" + queryString;
+        }
+        return result;
+    }
+
+    public String getAttachmentURL(String documentName, String attachmentName) throws Exception
+    {
+        return "/xwiki/bin/download/" + (documentName == null ? "currentdoc" : documentName.replace(".", "/")) + "/"
+            + attachmentName;
+    }
+
+    public String getProperty(String documentName, String className, int objectNumber, String propertyName)
+        throws Exception
+    {
+        throw new RuntimeException("Not implemented");
+    }
+
+    public String getProperty(String documentName, String className, String propertyName) throws Exception
+    {
+        return documentName.equals("XWiki.Admin") && 
+            className.equals("XWiki.XWikiUsers") && propertyName.equals("avatar") 
+            ? "mockAvatar.png"
+            : null;
+    }
+
+    public String getProperty(String documentName, String propertyName) throws Exception
+    {
+        throw new RuntimeException("Not implemented");
+    }
+
+    public String getPropertyType(String className, String propertyName) throws Exception
+    {
+        throw new RuntimeException("Not implemented");
+    }
+
+    public boolean isPropertyCustomMapped(String className, String propertyName) throws Exception
+    {
+        throw new RuntimeException("Not implemented");
+    }
+
+    public byte[] getAttachmentContent(String documentName, String attachmentName) throws Exception
+    {
+        throw new RuntimeException("Not implemented");
+    }
+
+    public boolean hasProgrammingRights()
+    {
+        return true;
+    }
+
+    public String getDocumentContentForDefaultLanguage(String arg0) throws Exception
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isDocumentViewable(String arg0)
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+}
Index: core/xwiki-macros/xwiki-macro-useravatar/src/test/resources/macrouseravatar1.test
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/test/resources/macrouseravatar1.test	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/test/resources/macrouseravatar1.test	(revision 0)
@@ -0,0 +1,12 @@
+.#-----------------------------------------------------
+.input|xwiki/2.0
+.#-----------------------------------------------------
+{{useravatar username="XWiki.Admin" width="100" height="200"/}}
+.#-----------------------------------------------------
+.expect|xhtml
+.#-----------------------------------------------------
+<!--startmacro:useravatar|-|username="XWiki.Admin" width="100" height="200"|-|--><!--startimage:XWiki.Admin@mockAvatar.png--><img src="/xwiki/bin/download/XWiki/Admin/mockAvatar.png" alt="Picture of Admin" width="100" height="200"/><!--stopimage--><!--stopmacro-->
+.#-----------------------------------------------------
+.expect|xwiki
+.#-----------------------------------------------------
+{{useravatar username="XWiki.Admin" width="100" height="200"/}}
\ No newline at end of file
Index: core/xwiki-macros/xwiki-macro-useravatar/src/main/java/org/xwiki/rendering/internal/macro/useravatar/UserAvatarMacro.java
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/main/java/org/xwiki/rendering/internal/macro/useravatar/UserAvatarMacro.java	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/main/java/org/xwiki/rendering/internal/macro/useravatar/UserAvatarMacro.java	(revision 0)
@@ -0,0 +1,126 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+package org.xwiki.rendering.internal.macro.useravatar;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.xwiki.bridge.DocumentAccessBridge;
+import org.xwiki.bridge.SkinAccessBridge;
+import org.xwiki.rendering.block.Block;
+import org.xwiki.rendering.block.WordBlock;
+import org.xwiki.rendering.block.ImageBlock;
+import org.xwiki.rendering.macro.AbstractMacro;
+import org.xwiki.rendering.macro.MacroExecutionException;
+import org.xwiki.rendering.macro.descriptor.DefaultMacroDescriptor;
+import org.xwiki.rendering.macro.useravatar.UserAvatarMacroParameters;
+import org.xwiki.rendering.transformation.MacroTransformationContext;
+import org.xwiki.rendering.listener.DocumentImage;
+import org.xwiki.rendering.listener.Image;
+import org.xwiki.rendering.listener.URLImage;
+
+/**
+ * Allows displaying the avatar for a specific user.
+ * 
+ * @version $Id: $
+ * @since 1.7
+ */
+public class UserAvatarMacro extends AbstractMacro<UserAvatarMacroParameters>
+{
+    /**
+     * The description of the macro.
+     */
+    private static final String DESCRIPTION =
+        "Allows displaying the avatar for a specific user.";
+
+    /**
+     * Injected by the Component Manager.
+     */
+    private DocumentAccessBridge documentAccessBridge;
+
+    /**
+     * Injected by the Component Manager.
+     */
+    private SkinAccessBridge skinAccessBridge;
+    
+    /**
+     * Create and initialize the descriptor of the macro.
+     */
+    public UserAvatarMacro()
+    {
+        super(new DefaultMacroDescriptor(DESCRIPTION, UserAvatarMacroParameters.class));
+    }
+    
+    /**
+     *  {@inheritDoc}
+     * @see org.xwiki.rendering.macro.Macro#execute(java.lang.Object, java.lang.String, org.xwiki.rendering.transformation.MacroTransformationContext)
+     */
+    public List<Block> execute(UserAvatarMacroParameters parameters, String content, MacroTransformationContext context)
+        throws MacroExecutionException
+    {
+        String atachment = null;
+        String userName = parameters.getUsername(); 
+        Block resultedBlock = null;
+        
+        try {
+            atachment = documentAccessBridge.getProperty(userName, "XWiki.XWikiUsers", "avatar");
+            Image image = null;
+            
+            image = StringUtils.isBlank(atachment)
+                ? new URLImage(skinAccessBridge.getSkinFile("noavatar.png"))
+                : new DocumentImage(userName, atachment);
+            
+            ImageBlock imageBlock = new ImageBlock(image, false);
+            imageBlock.setParameter("alt", "Picture of " + userName.split("[.]")[1]);
+            
+            if (parameters.getWidth() != null) {
+                imageBlock.setParameter("width", parameters.getWidth());
+            }
+            
+            if (parameters.getHeight() != null) {
+                imageBlock.setParameter("height", parameters.getHeight());
+            }
+            
+            resultedBlock = imageBlock;
+            
+        } catch (Exception e) {
+            resultedBlock = new WordBlock(e.getMessage());
+        }
+        return Collections.singletonList(resultedBlock);
+    }
+
+    /** 
+     * {@inheritDoc}
+     * @see org.xwiki.rendering.macro.Macro#supportsInlineMode()
+     */
+    public boolean supportsInlineMode()
+    {
+        return false;
+    }
+
+    /**
+     * dumb method for testing purposes.
+     */
+    public void dumbMethod() {
+        
+    }
+}
Index: core/xwiki-macros/xwiki-macro-useravatar/pom.xml
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/pom.xml	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/pom.xml	(revision 0)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>xwiki-core-macros-parent</artifactId>
+    <groupId>org.xwiki.platform</groupId>
+    <version>1.7-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>xwiki-core-macro-useravatar</artifactId>
+  <name>XWiki Platform - Macro - UserAvatar</name>
+  <version>1.7-SNAPSHOT</version>
+  <description>XWiki Platform - Macro - UserAvatar</description>
+  <build>
+    <plugins>
+      <plugin>
+        <!-- Apply the Checkstyle configurations defined in the top level pom.xml file -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/RenderingTests.java</include>
+          </includes>
+          <excludes>
+            <exclude>**/scaffolding/**.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.xwiki.platform</groupId>
+      <artifactId>xwiki-core-bridge</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file
Index: core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/scaffolding/UserAvatarRenderingPlexusTestSetup.java
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/scaffolding/UserAvatarRenderingPlexusTestSetup.java	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/scaffolding/UserAvatarRenderingPlexusTestSetup.java	(revision 0)
@@ -0,0 +1,25 @@
+package org.xwiki.rendering.scaffolding;
+
+import org.xwiki.rendering.internal.UserAvatarMockDocumentAccessBridge;
+import org.xwiki.rendering.internal.UserAvatarMockSkinAccessBridge;
+import org.xwiki.rendering.scaffolding.RenderingPlexusTestSetup;
+
+import junit.framework.TestSuite;
+
+
+public class UserAvatarRenderingPlexusTestSetup extends RenderingPlexusTestSetup
+{
+    public UserAvatarRenderingPlexusTestSetup(TestSuite suite)
+    {
+        super(suite);
+    }
+
+    @Override
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+
+        getComponentManager().registerComponentDescriptor(UserAvatarMockDocumentAccessBridge.getComponentDescriptor());
+        getComponentManager().registerComponentDescriptor(UserAvatarMockSkinAccessBridge.getComponentDescriptor());
+    }
+}
Index: core/xwiki-macros/pom.xml
===================================================================
--- core/xwiki-macros/pom.xml	(revision 14594)
+++ core/xwiki-macros/pom.xml	(working copy)
@@ -68,6 +68,7 @@
     <module>xwiki-macro-groovy</module>
     <module>xwiki-macro-box</module>
     <module>xwiki-macro-code</module>
+    <module>xwiki-macro-useravatar</module>
   </modules>
 </project>
        
Index: core/xwiki-macros/xwiki-macro-useravatar/src/test/resources/macrouseravatar2.test
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/test/resources/macrouseravatar2.test	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/test/resources/macrouseravatar2.test	(revision 0)
@@ -0,0 +1,12 @@
+.#-----------------------------------------------------
+.input|xwiki/2.0
+.#-----------------------------------------------------
+{{useravatar username="XWiki.noUser" /}}
+.#-----------------------------------------------------
+.expect|xhtml
+.#-----------------------------------------------------
+<!--startmacro:useravatar|-|username="XWiki.noUser"|-|--><!--startimage:/xwiki/noavatar.png--><img src="/xwiki/noavatar.png" alt="Picture of noUser"/><!--stopimage--><!--stopmacro-->
+.#-----------------------------------------------------
+.expect|xwiki
+.#-----------------------------------------------------
+{{useravatar username="XWiki.noUser"/}}
\ No newline at end of file
Index: core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/internal/UserAvatarMockSkinAccessBridge.java
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/internal/UserAvatarMockSkinAccessBridge.java	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/internal/UserAvatarMockSkinAccessBridge.java	(revision 0)
@@ -0,0 +1,61 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.rendering.internal;
+
+import org.xwiki.bridge.SkinAccessBridge;
+import org.xwiki.component.descriptor.ComponentDescriptor;
+import org.xwiki.component.descriptor.DefaultComponentDescriptor;
+
+/**
+ * Mock {@link XWikiAccessBridge} implementation used for testing, since we don't want to pull any dependency on the
+ * Model/Skin/etc for the Rendering module's unit tests.
+ * 
+ * @version $Id: MockVelocityManager.java 10176 2008-06-09 16:11:28Z vmassol $
+ * @since 1.6M1
+ */
+public class UserAvatarMockSkinAccessBridge implements SkinAccessBridge
+{
+    /**
+     * Create and return a descriptor for this component.
+     * 
+     * @return the descriptor of the component.
+     */
+    public static ComponentDescriptor getComponentDescriptor()
+    {
+        DefaultComponentDescriptor componentDescriptor = new DefaultComponentDescriptor();
+
+        componentDescriptor.setRole(SkinAccessBridge.ROLE);
+        componentDescriptor.setRoleHint("default");
+        componentDescriptor.setImplementation(UserAvatarMockSkinAccessBridge.class.getName());
+
+        return componentDescriptor;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @see org.xwiki.bridge.XWikiBridge#getSkinFile(String fileName)
+     */
+    public String getSkinFile(String fileName)
+    {
+        return fileName.equals("noavatar.png") 
+            ? "/xwiki/noavatar.png"
+            : null;
+    }
+}
Index: core/xwiki-macros/xwiki-macro-useravatar/src/main/java/org/xwiki/rendering/macro/useravatar/UserAvatarMacroParameters.java
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/main/java/org/xwiki/rendering/macro/useravatar/UserAvatarMacroParameters.java	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/main/java/org/xwiki/rendering/macro/useravatar/UserAvatarMacroParameters.java	(revision 0)
@@ -0,0 +1,98 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.rendering.macro.useravatar;
+
+import org.xwiki.rendering.macro.descriptor.ParameterDescription;
+import org.xwiki.rendering.macro.descriptor.ParameterMandatory;
+
+/**
+ * Parameters for the {@link org.xwiki.rendering.internal.macro.useravatar.UserAvatarMacro} Macro.
+ * 
+ * @version $Id: $
+ * @since 1.7
+ */
+public class UserAvatarMacroParameters
+{
+    /**
+     * The name of the user whose avatar is to be displayed.
+     */
+    private String username;
+    
+    /**
+     * The width of the image (optional).
+     */
+    private Integer width;
+    
+    /**
+     * The height of the image.
+     */
+    private Integer height;
+    
+    /**
+     * @return the name of the user whose avatar is to be displayed
+     */
+    public String getUsername()
+    {
+        return username;
+    }
+
+    /**
+     * @param username the name of the user whose avatar is to be displayed
+     */
+    @ParameterMandatory
+    @ParameterDescription("the name of the user whose avatar is to be displayed")
+    public void setUsername(String username)
+    {
+        this.username = username;
+    }
+
+    /**
+     * @return the width of the image.
+     */
+    public Integer getWidth()
+    {
+        return width;
+    }
+    /**
+     * @param width the width of the image
+     */
+    @ParameterDescription("the image's width")
+    public void setWidth(Integer width)
+    {
+        this.width = width;
+    }
+
+    /**
+     * @return the height of the image
+     */
+    public Integer getHeight()
+    {
+        return height;
+    }
+
+    /**
+     * @param height the height of the image
+     */
+    @ParameterDescription("the image's height")
+    public void setHeight(Integer height)
+    {
+        this.height = height;
+    }
+}
Index: core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/scaffolding/AbstractUserAvatarRenderingTestCase.java
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/scaffolding/AbstractUserAvatarRenderingTestCase.java	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/scaffolding/AbstractUserAvatarRenderingTestCase.java	(revision 0)
@@ -0,0 +1,73 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.rendering.scaffolding;
+
+import java.util.List;
+
+import org.xwiki.rendering.block.Block;
+import org.xwiki.rendering.block.XDOM;
+import org.xwiki.rendering.internal.UserAvatarMockDocumentAccessBridge;
+import org.xwiki.rendering.internal.UserAvatarMockSkinAccessBridge;
+import org.xwiki.rendering.internal.configuration.MockConfigurationSourceCollection;
+import org.xwiki.rendering.internal.util.MockIdGenerator;
+import org.xwiki.rendering.renderer.DefaultWikiPrinter;
+import org.xwiki.rendering.renderer.EventsRenderer;
+import org.xwiki.rendering.renderer.WikiPrinter;
+
+import com.xpn.xwiki.test.AbstractXWikiComponentTestCase;
+
+public abstract class AbstractUserAvatarRenderingTestCase extends AbstractXWikiComponentTestCase
+{
+    public AbstractUserAvatarRenderingTestCase()
+    {
+        super();
+    }
+
+    public AbstractUserAvatarRenderingTestCase(String testName)
+    {
+        super(testName);
+    }
+
+    protected void assertBlocks(String expected, List<Block> blocks)
+    {
+        // Assert the result by parsing it through the EventsRenderer to generate easily
+        // assertable events.
+        XDOM dom = new XDOM(blocks);
+        WikiPrinter printer = new DefaultWikiPrinter();
+        dom.traverse(new EventsRenderer(printer));
+        assertEquals(expected, printer.toString());
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see com.xpn.xwiki.test.AbstractXWikiComponentTestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+
+        getComponentManager().registerComponentDescriptor(UserAvatarMockDocumentAccessBridge.getComponentDescriptor());
+        getComponentManager().registerComponentDescriptor(UserAvatarMockSkinAccessBridge.getComponentDescriptor());
+        getComponentManager().registerComponentDescriptor(MockIdGenerator.getComponentDescriptor());
+        getComponentManager().registerComponentDescriptor(MockConfigurationSourceCollection.getComponentDescriptor());
+    }
+}
Index: core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/RenderingTests.java
===================================================================
--- core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/RenderingTests.java	(revision 0)
+++ core/xwiki-macros/xwiki-macro-useravatar/src/test/java/org/xwiki/rendering/RenderingTests.java	(revision 0)
@@ -0,0 +1,45 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.rendering;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+import org.xwiki.rendering.scaffolding.UserAvatarRenderingPlexusTestSetup;
+import org.xwiki.rendering.scaffolding.RenderingTestSuite;
+
+/**
+ * All Rendering integration tests defined in text files using a special format.
+ * 
+ * @version $Id: $
+ * @since 1.7
+ */
+public class RenderingTests extends TestCase
+{
+    public static Test suite() throws Exception
+    {
+        RenderingTestSuite suite = new RenderingTestSuite("Test all Parsers/Renderers");
+        
+        suite.addTestsFromResource("macrouseravatar1", true);
+        suite.addTestsFromResource("macrouseravatar2", true);
+        
+        return new UserAvatarRenderingPlexusTestSetup(suite);
+    }
+}
