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

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.macro.MacroTransformationConfiguration;
import org.xwiki.test.jmock.AbstractMockingComponentTestCase;
import org.xwiki.test.jmock.annotation.MockingRequirement;

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

    private ConfigurationSource source;

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

    @Test
    public void testGetCategories() throws Exception
    {
        getMockery().checking(new Expectations()
        {
            {
                oneOf(source).getProperty("rendering.transformation.macro.categories", Properties.class);
                will(returnValue(new Properties()));
            }
        });

        Properties categories = this.configuration.getCategories();
        Assert.assertNotNull(categories);
        Assert.assertEquals(0, categories.size());
    }
}

@@ -993,74 +993,16 @@
 rg.j
-mock.Expectations;%0Aimport org.junit.Assert;%0Aimport org.junit.Befor
+unit.Rul
 e;%0Ai
@@ -1096,192 +1096,120 @@
 iki.
-rendering.transformation.macro.MacroTransformationConfiguration;%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/
@@ -1322,73 +1322,8 @@
  */%0A
-@MockingRequirement(XWikiMacroTransformationConfiguration.class)%0A
 publ
@@ -1376,32 +1376,39 @@
 Test
- extends Abstract
+%0A%7B%0A    @Rule%0A    public 
 Mocki
-ng
+to
 Comp
@@ -1416,31 +1416,25 @@
 nent
-TestCase%0A%7B%0A    private 
+MockingRule%3CXWiki
 Macr
@@ -1465,276 +1465,66 @@
 tion
- configuration;%0A%0A    private ConfigurationSource source;%0A%0A    @Before%0A    public void configure() throws Exception%0A    %7B%0A        this.source = getComponentManager().getInstance(ConfigurationSource.class);%0A        this.configuration = getComponentManager().getInstance(
+%3E mocker =%0A        new MockitoComponentMockingRule%3C%3E(XWiki
 Macr
@@ -1559,22 +1559,16 @@
 .class);
-%0A    %7D
 %0A%0A    @T
@@ -1591,13 +1591,9 @@
 oid 
-testG
+g
 etCa
@@ -1638,102 +1638,108 @@
     
-getMockery().checking(new Expectations()%0A        %7B%0A            %7B%0A                oneOf
+ConfigurationSource source = this.mocker.getInstance(ConfigurationSource.class);%0A        when
 (source
-)
 .get
@@ -1813,43 +1813,34 @@
 ass)
-;%0A                will(returnValue(
+).thenReturn(%0A            
 new 
@@ -1856,36 +1856,9 @@
 s())
-)
 ;
-%0A            %7D%0A        %7D);
 %0A%0A  
@@ -1892,29 +1892,46 @@
  = this.
-configuration
+mocker.getComponentUnderTest()
 .getCate
@@ -1944,31 +1944,24 @@
 ();%0A        
-Assert.
 assertNotNul
@@ -1983,23 +1983,16 @@
         
-Assert.
 assertEq

Migrate unit test to Mockito