<commit_before>package de.tuberlin.dima.schubotz.fse;

import eu.stratosphere.util.Collector;
import org.junit.Test;

import java.util.ArrayList;

public class QueryMapperTest {

    @Test
    public void testFlatMap() throws Exception {
        QueryMapper queryMapper = new QueryMapper();
        final ArrayList<Query> queries = new ArrayList<>();
        Collector<Query> col = new Collector<Query>() {
            @Override
            public void collect(Query record) {
                System.out.println(record.name);
                queries.add(record);
            }

            @Override
            public void close() {

            }
        };
        queryMapper.flatMap(TestUtils.getTestQueryString(), col);

    }
}<commit_msg>Add more tests<commit_after>package de.tuberlin.dima.schubotz.fse;

import eu.stratosphere.util.Collector;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

import java.util.ArrayList;

import static junit.framework.Assert.assertEquals;

public class QueryMapperTest {
    @Test
    public void testFlatMap() throws Exception {
        QueryMapper queryMapper = new QueryMapper();
        final ArrayList<Query> queries = new ArrayList<>();
        Collector<Query> col = new Collector<Query>() {
            @Override
            public void collect(Query record) {
                // System.out.println(record.name);
                queries.add(record);
            }

            @Override
            public void close() {

            }
        };
        queryMapper.flatMap(TestUtils.getTestQueryString(), col);
        Query query10 = queries.get(9);
        assertEquals("NTCIR11-Math-10", query10.name);
        assertEquals(1, query10.formulae.size());
        assertEquals(4, query10.keywords.size());
        assertEquals(true, query10.keywords.containsKey("w1.3"));
        assertEquals("code", query10.keywords.get("w1.3"));
        assertEquals(true, query10.formulae.containsKey("f1.0"));
        Document testDoc = query10.formulae.get("f1.0");
        Node texExpression = XMLHelper.getElementB(testDoc, "/math/semantics/annotation");
        assertEquals("f(\\qvar{x})=\\frac{1}{\\sigma\\sqrt{2\\pi}}\\qvar{z}", texExpression.getTextContent().trim());
    }
}
{'fraction_non_alphanumeric': 0.12694185530403906, 'fraction_numerical': 0.015534842432312472, 'mean_word_length': 2.5440251572327046, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4669628', 'n_tokens_mistral': 659, 'n_tokens_neox': 631, 'n_words': 119}