/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2017, by Object Refinery Limited and Contributors.
 *
 * Project Info:  http://www.jfree.org/jfreechart/index.html
 *
 * This library 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 library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA.
 *
 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
 * Other names may be trademarks of their respective owners.]
 *
 * ----------------------
 * ImageMapUtilsTest.java
 * ----------------------
 * (C) Copyright 2009-2017, by Object Refinery Limited and Contributors.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * Changes
 * -------
 * 25-Mar-2009 : Version 1 (DG);
 *
 */

package org.jfree.chart.imagemap;

import static org.junit.Assert.assertEquals;
import org.junit.Test;

/**
 * Tests for the {@link ImageMapUtils} class.
 */
public class ImageMapUtilsTest {

    /**
     * Some checks for the htmlEscape() method.
     */
    @Test
    public void testHTMLEscape() {
        assertEquals("", ImageMapUtils.htmlEscape(""));
        assertEquals("abc", ImageMapUtils.htmlEscape("abc"));
        assertEquals("&amp;", ImageMapUtils.htmlEscape("&"));
        assertEquals("&quot;", ImageMapUtils.htmlEscape("\""));
        assertEquals("&lt;", ImageMapUtils.htmlEscape("<"));
        assertEquals("&gt;", ImageMapUtils.htmlEscape(">"));
        assertEquals("&#39;", ImageMapUtils.htmlEscape("\'"));
        assertEquals("&#092;abc", ImageMapUtils.htmlEscape("\\abc"));
        assertEquals("abc\n", ImageMapUtils.htmlEscape("abc\n"));
    }

    /**
     * Some checks for the javascriptEscape() method.
     */
    @Test
    public void testJavascriptEscape() {
        assertEquals("", ImageMapUtils.javascriptEscape(""));
        assertEquals("abc", ImageMapUtils.javascriptEscape("abc"));
        assertEquals("\\\'", ImageMapUtils.javascriptEscape("\'"));
        assertEquals("\\\"", ImageMapUtils.javascriptEscape("\""));   
        assertEquals("\\\\", ImageMapUtils.javascriptEscape("\\"));
    }

}

@@ -1562,16 +1562,346 @@
 gemap;%0A%0A
+import org.jfree.chart.ChartRenderingInfo;%0Aimport org.jfree.chart.entity.ChartEntity;%0Aimport org.jfree.chart.entity.EntityCollection;%0Aimport org.jfree.chart.entity.StandardEntityCollection;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.ExpectedException;%0A%0Aimport java.awt.Rectangle;%0Aimport java.awt.Shape;%0A%0A
 import s
@@ -1936,39 +1936,16 @@
 tEquals;
-%0Aimport org.junit.Test;
 %0A%0A/**%0A *
@@ -2026,16 +2026,87 @@
 Test %7B%0A%0A
+    @Rule public ExpectedException thrown = ExpectedException.none();%0A%0A
     /**%0A
@@ -3243,10 +3243,1255 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void testGetImageMap() %7B%0A        final Shape shape = new Rectangle(1, 2, 3, 4);%0A        final Shape shape2 = new Rectangle(5, 6, 7, 8);%0A%0A        EntityCollection entities = new StandardEntityCollection();%0A%0A        entities.add(new ChartEntity(shape, %22toolTip1%22, %22URL1%22));%0A        entities.add(new ChartEntity(shape2, %22toolTip2%22, %22URL2%22));%0A%0A        final String retval = ImageMapUtils.getImageMap(%22name%22, new ChartRenderingInfo(entities),%0A                new StandardToolTipTagFragmentGenerator(), new StandardURLTagFragmentGenerator());%0A%0A        assertEquals(%22%3Cmap id=%5C%22name%5C%22 name=%5C%22name%5C%22%3E%5Cn%22 +%0A                %22%3Carea shape=%5C%22rect%5C%22 coords=%5C%225,6,12,14%5C%22 title=%5C%22toolTip2%5C%22 alt=%5C%22%5C%22 href=%5C%22URL2%5C%22/%3E%5Cn%22 +%0A                %22%3Carea shape=%5C%22rect%5C%22 coords=%5C%221,2,4,6%5C%22 title=%5C%22toolTip1%5C%22 alt=%5C%22%5C%22 href=%5C%22URL1%5C%22/%3E%5Cn%22 +%0A                %22%3C/map%3E%22, retval);%0A    %7D%0A%0A    @Test%0A    public void testGetImageMapIllegalArgumentException() %7B%0A        thrown.expect(IllegalArgumentException.class);%0A        ImageMapUtils.getImageMap(null, null, null, null);%0A    %7D%0A%0A    @Test%0A    public void testGetImageMapIllegalArgumentException_2() %7B%0A        thrown.expect(IllegalArgumentException.class);%0A        ImageMapUtils.getImageMap(null, null);%0A    %7D%0A
 %7D%0A

Add tests for org.jfree.chart.imagemap.ImageMapUtils