/*
 * 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.transformation.icon;

import java.util.Properties;

import org.jmock.Expectations;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.xwiki.configuration.ConfigurationSource;
import org.xwiki.rendering.transformation.icon.IconTransformationConfiguration;
import org.xwiki.test.jmock.AbstractMockingComponentTestCase;
import org.xwiki.test.jmock.annotation.MockingRequirement;

/**
 * Unit tests for {@link XWikiIconTransformationConfiguration}.
 *
 * @version $Id$
 * @since 2.6RC1
 */
@MockingRequirement(XWikiIconTransformationConfiguration.class)
public class XWikiIconTransformationConfigurationTest extends AbstractMockingComponentTestCase
{
    private IconTransformationConfiguration configuration;

    private ConfigurationSource source;

    @Before
    public void configure() throws Exception
    {
        this.source = getComponentManager().getInstance(ConfigurationSource.class);
        this.configuration = getComponentManager().getInstance(IconTransformationConfiguration.class);
    }

    @Test
    public void testGetMappings() throws Exception
    {
        getMockery().checking(new Expectations()
        {
            {
                oneOf(source).getProperty("rendering.transformation.icon.mappings", Properties.class);
                Properties props = new Properties();
                props.setProperty("::", "test");
                will(returnValue(props));
            }
        });

        Properties mappings = this.configuration.getMappings();
        Assert.assertNotNull(mappings);
        // Make sure we have our mapping coming from the configuration source + the default mappings
        Assert.assertTrue(mappings.size() > 1);
        Assert.assertEquals("test", mappings.getProperty("::"));
    }
}

@@ -992,74 +992,16 @@
 rg.j
-mock.Expectations;%0Aimport org.junit.Assert;%0Aimport org.junit.Befor
+unit.Rul
 e;%0Ai
@@ -1095,190 +1095,120 @@
 iki.
-rendering.transformation.icon.IconTransformationConfiguration;%0Aimport org.xwiki.test.jmock.AbstractMockingComponentTestCase;%0Aimport org.xwiki.test.jmock.annotation.MockingRequirement
+test.mockito.MockitoComponentMockingRule;%0A%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Mockito.*
 ;%0A%0A/
@@ -1319,28 +1319,21 @@
  */%0A
-@MockingRequirement(
+public class 
 XWik
@@ -1368,29 +1368,64 @@
 tion
-.class)%0Apublic class 
+Test%0A%7B%0A    @Rule%0A    public MockitoComponentMockingRule%3C
 XWik
@@ -1460,36 +1460,38 @@
 tion
-Test extends Abstract
+%3E mocker =%0A        new 
 Mocki
-ng
+to
 Comp
@@ -1499,31 +1499,27 @@
 nent
-TestCase%0A%7B%0A    private 
+MockingRule%3C%3E(XWiki
 Icon
@@ -1549,71 +1549,23 @@
 tion
- configuration;%0A%0A    private ConfigurationSource source
+.class)
 ;%0A%0A    @
 Befo
@@ -1564,14 +1564,12 @@
    @
-Before
+Test
 %0A   
@@ -1585,17 +1585,19 @@
 oid 
-configure
+getMappings
 () t
@@ -1630,165 +1630,61 @@
     
-this.source = getComponentManager().getInstance(ConfigurationSource.class);%0A        this.configuration = getComponentManager().getInstance(IconTransformation
+ConfigurationSource source = this.mocker.getInstance(
 Conf
@@ -1684,32 +1684,38 @@
 ce(Configuration
+Source
 .class);%0A    %7D%0A%0A
@@ -1715,180 +1715,109 @@
     
-%7D%0A%0A
     
-@Test%0A    public void testGetMappings() throws Exception%0A    %7B%0A        getMock
+Properties props = new Properties();%0A        props.setProp
 er
+t
 y(
-).checking(new Expectations()%0A        %7B%0A            %7B%0A                oneOf
+%22::%22, %22test%22);%0A        when
 (source
-)
 .get
@@ -1888,177 +1888,26 @@
 ass)
-;%0A                Properties props = new Properties();%0A                props.setProperty(%22::%22, %22test%22);%0A                will(returnValue(props));%0A            %7D%0A        %7D
+).thenReturn(props
 );%0A%0A
@@ -1941,29 +1941,46 @@
  = this.
-configuration
+mocker.getComponentUnderTest()
 .getMapp
@@ -1991,31 +1991,24 @@
 ();%0A        
-Assert.
 assertNotNul
@@ -2125,31 +2125,24 @@
 ngs%0A        
-Assert.
 assertTrue(m
@@ -2170,23 +2170,16 @@
         
-Assert.
 assertEq

Migrate unit test to Mockito