package nl.hsac.fitnesse.fixture.util;

import org.junit.Test;

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

public class HtmlCleanerTest {
    private final HtmlCleaner cleaner = new HtmlCleaner();

    @Test
    public void testCleanUrl() {
        assertEquals("http://hallo.com/test", cleaner.getUrl("http://hallo.com/test"));
        assertEquals("http://hallo.com/test2", cleaner.getUrl("<a href=\"http://hallo.com/test2\">Hallo</a>"));
        assertEquals("http://hallo.com/test3?testparam=1", cleaner.getUrl("<a href=\"http://hallo.com/test3?testparam=1\">Hallo2</a>"));
        assertEquals("http://hallo.com/test3?testparam=1&param2=3", cleaner.getUrl("<a href=\"http://hallo.com/test3?testparam=1&amp;param2=3\">Hallo3</a>"));

        assertNull(cleaner.getUrl(null));
    }
}

@@ -773,24 +773,143 @@
 o3%3C/a%3E%22));%0A%0A
+        assertEquals(%22http://hallo.com/test2123%22, cleaner.getUrl(%22%3Ca href=%5C%22http://hallo.com/test2%5C%22%3EHallo%3C/a%3E123%22));%0A%0A
         asse

Add test to ensure extra content after <a></a> is also extracted