<commit_before>package org.htmlcleaner;

import junit.framework.TestCase;

/**
 * Test cases for for {@link BrowserCompactXmlSerializer}
 * 
 * @author <NAME> (<EMAIL>)
 *
 */
public class BrowserCompactXmlSerializerTest extends TestCase {

    /**
     * Tests that serializer removes white spaces properly.
     */
    public void testRemoveInsignificantWhitespaces(){
        CleanerProperties properties = new CleanerProperties();
        properties.setOmitHtmlEnvelope(true);
        properties.setOmitXmlDeclaration(true);
        BrowserCompactXmlSerializer compactXmlSerializer = new BrowserCompactXmlSerializer(properties);
        String cleaned = compactXmlSerializer.getXmlAsString(properties, "        <u>text here, </u><b>some text</b>      ", "UTF-8");
        assertEquals("<u>text here, </u><b>some text</b>", cleaned);
        cleaned = compactXmlSerializer.getXmlAsString(properties, "    <div class=\"foo\">2 roots < here >  </div>", "UTF-8");
        assertEquals("<div class=\"foo\">2 roots &lt; here &gt;</div>", cleaned);
        cleaned = compactXmlSerializer.getXmlAsString(properties, "    <div class=\"foo\">2 roots \n    < here >  </div>", "UTF-8");
        assertEquals("<div class=\"foo\">2 roots\n&lt; here &gt;</div>", cleaned);
    }<commit_msg>Corrected test.<commit_after>package org.htmlcleaner;

import junit.framework.TestCase;

/**
 * Test cases for for {@link BrowserCompactXmlSerializer}
 * 
 * @author <NAME> (<EMAIL>)
 *
 */
public class BrowserCompactXmlSerializerTest extends TestCase {

    /**
     * Tests that serializer removes white spaces properly.
     */
    public void testRemoveInsignificantWhitespaces(){
        CleanerProperties properties = new CleanerProperties();
        properties.setOmitHtmlEnvelope(true);
        properties.setOmitXmlDeclaration(true);
        BrowserCompactXmlSerializer compactXmlSerializer = new BrowserCompactXmlSerializer(properties);
        String cleaned = compactXmlSerializer.getXmlAsString(properties, "        <u>text here, </u><b>some text</b>      ", "UTF-8");
        assertEquals("<u>text here, </u><b>some text</b>", cleaned);
        cleaned = compactXmlSerializer.getXmlAsString(properties, "    <div class=\"foo\">2 roots < here >  </div>", "UTF-8");
        assertEquals("<div class=\"foo\">2 roots &lt; here &gt;</div>", cleaned);
        cleaned = compactXmlSerializer.getXmlAsString(properties, "    <div class=\"foo\">2 roots \n    < here >  </div>", "UTF-8");
        assertEquals("<div class=\"foo\">2 roots &lt; here &gt;</div>", cleaned);
        cleaned = compactXmlSerializer.getXmlAsString(properties, "    <div class=\"foo\">2 roots \n\n    < here >  </div>", "UTF-8");
        assertEquals("<div class=\"foo\">2 roots <br />&lt; here &gt;</div>", cleaned);
    }
{'fraction_non_alphanumeric': 0.15061107117181882, 'fraction_numerical': 0.006110711718188354, 'mean_word_length': 3.622923588039867, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4438732', 'n_tokens_mistral': 783, 'n_tokens_neox': 775, 'n_words': 181}