Browse souce code repository at: https://github.com/jjYBdx4IL/java-evaluation/blob/master/src/test/java/org/owasp/html/SanitizeTest.java
package org.owasp.html;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class SanitizeTest {

    @Test
    public void test1() {
        String testStr = "<pre class=\"bla\">1</pre>";
        
        PolicyFactory policy = new HtmlPolicyBuilder().allowElements("pre").allowAttributes("class").onElements("pre")
            .toFactory();
        policy = policy.and(Sanitizers.FORMATTING).and(Sanitizers.LINKS).and(Sanitizers.IMAGES).and(Sanitizers.STYLES)
            .and(Sanitizers.TABLES).and(Sanitizers.BLOCKS);
        assertEquals(testStr, policy.sanitize(testStr));
    }
}
-------------------------------------------------------------------------------
Test set: org.owasp.html.SanitizeTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.107 s - in org.owasp.html.SanitizeTest
test1  Time elapsed: 0.107 s