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

import java.util.HashMap;
import java.util.Map;

import org.xwiki.chart.internal.DefaultChartGenerator;
import org.xwiki.chart.model.ChartModel;
import org.xwiki.chart.model.DefaultChartModel;
import org.xwiki.test.AbstractXWikiComponentTestCase;

/**
 * Test case for {@link DefaultChartGenerator}.
 * 
 * @version $Id$
 * @since 2.0M1
 */
public class DefaultChartGeneratorTest extends AbstractXWikiComponentTestCase
{
    /**
     * The {@link ChartGenerator} component.
     */
    private ChartGenerator chartGenerator;

    /**
     * The {@link ChartModel}.
     */
    private ChartModel model;

    /**
     * {@inheritDoc}
     */
    protected void setUp() throws Exception
    {
        super.setUp();
        Short dataArray[][] = { {1, 2, 3}, {1, 3, 5}};
        String rowHeaders[] = {"1", "2"};
        String columnHeaders[] = {"1", "2", "3"};
        this.model = new DefaultChartModel(dataArray, rowHeaders, columnHeaders);
        this.chartGenerator = getComponentManager().lookup(ChartGenerator.class);
    }

    /**
     * Test pie chart generation.
     * 
     * @throws ChartGeneratorException if an error occurs while generating the chart.
     */
    public final void testPieChart() throws ChartGeneratorException
    {
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ChartGenerator.TITLE_PARAM, "Test pie chart");
        parameters.put(ChartGenerator.TYPE_PARAM, "pie");
        parameters.put(ChartGenerator.SERIES_PARAM, "rows");

        byte[] chart = chartGenerator.generate(model, parameters);
        assertNotNull(chart);
    }

    /**
     * Test bar chart generation.
     * 
     * @throws ChartGeneratorException if an error occurs while generating the chart.
     */
    public final void testBarChart() throws ChartGeneratorException
    {
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ChartGenerator.TITLE_PARAM, "Test bar chart");
        parameters.put(ChartGenerator.TYPE_PARAM, "bar");
        parameters.put(ChartGenerator.SERIES_PARAM, "rows");

        byte[] chart = chartGenerator.generate(model, parameters);
        assertNotNull(chart);
    }

    /**
     * Test line chart generation.
     * 
     * @throws ChartGeneratorException if an error occurs while generating the chart.
     */
    public final void testLineChart() throws ChartGeneratorException
    {
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ChartGenerator.TITLE_PARAM, "Test line chart");
        parameters.put(ChartGenerator.TYPE_PARAM, "line");
        parameters.put(ChartGenerator.SERIES_PARAM, "rows");

        byte[] chart = chartGenerator.generate(model, parameters);
        assertNotNull(chart);
    }

    /**
     * Test area chart generation.
     * 
     * @throws ChartGeneratorException if an error occurs while generating the chart.
     */
    public final void testAreaChart() throws ChartGeneratorException
    {
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put(ChartGenerator.TITLE_PARAM, "Test area chart");
        parameters.put(ChartGenerator.TYPE_PARAM, "area");
        parameters.put(ChartGenerator.SERIES_PARAM, "rows");

        byte[] chart = chartGenerator.generate(model, parameters);
        assertNotNull(chart);
    }
}

@@ -962,16 +962,64 @@
 l.Map;%0A%0A
+import org.junit.Assert;%0Aimport org.junit.Test;%0A
 import o
@@ -1176,37 +1176,32 @@
 ki.test.Abstract
-XWiki
 ComponentTestCas
@@ -1356,13 +1356,8 @@
 ract
-XWiki
 Comp
@@ -1611,21 +1611,34 @@
 ed void 
-setUp
+registerComponents
 () throw
@@ -1659,31 +1659,8 @@
   %7B%0A
-        super.setUp();%0A
     
@@ -2109,32 +2109,42 @@
  chart.%0A     */%0A
+    @Test%0A
     public final
@@ -2530,32 +2530,39 @@
 eters);%0A        
+Assert.
 assertNotNull(ch
@@ -2710,32 +2710,42 @@
  chart.%0A     */%0A
+    @Test%0A
     public final
@@ -3131,32 +3131,39 @@
 eters);%0A        
+Assert.
 assertNotNull(ch
@@ -3312,32 +3312,42 @@
  chart.%0A     */%0A
+    @Test%0A
     public final
@@ -3736,32 +3736,39 @@
 eters);%0A        
+Assert.
 assertNotNull(ch
@@ -3921,24 +3921,34 @@
 rt.%0A     */%0A
+    @Test%0A
     public f
@@ -4349,16 +4349,23 @@
         
+Assert.
 assertNo

Convert tests to JUnit 4