Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HTMLFilterTest.java « test « filter « i18n « bouncycastle « org « java « test « src « core - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e1dfb733e5bc75184b025fcb3be34a706a8e048f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.bouncycastle.i18n.filter.test;

import org.bouncycastle.i18n.filter.Filter;
import org.bouncycastle.i18n.filter.HTMLFilter;

import junit.framework.TestCase;

public class HTMLFilterTest extends TestCase
{

    private static final String test1 = "hello world";

    private static final String test2 = "<script></script>";

    private static final String test3 = "javascript:attack()";

    private static final String test4 = "\"hello\"";

    public void testDoFilter()
    {
        Filter dummy = new HTMLFilter();

        assertEquals("No filtering", "hello world", dummy.doFilter(test1));
        assertEquals("script tags", "&#60script&#62&#60/script&#62", dummy.doFilter(test2));
        assertEquals("javascript link", "javascript:attack&#40&#41", dummy.doFilter(test3));
        assertEquals("", "&#34hello&#34", dummy.doFilter(test4));
    }

}