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);

    }
}
@@ -99,35 +99,141 @@
 st;%0A
-%0Aimport java.util.ArrayList
+import org.w3c.dom.Document;%0Aimport org.w3c.dom.Node;%0A%0Aimport java.util.ArrayList;%0A%0Aimport static junit.framework.Assert.assertEquals
 ;%0A%0Ap
@@ -262,17 +262,16 @@
 rTest %7B%0A
-%0A
     @Tes
@@ -575,16 +575,19 @@
         
+ //
  System.
@@ -812,16 +812,668 @@
 , col);%0A
+        Query query10 = queries.get(9);%0A        assertEquals(%22NTCIR11-Math-10%22, query10.name);%0A        assertEquals(1, query10.formulae.size());%0A        assertEquals(4, query10.keywords.size());%0A        assertEquals(true, query10.keywords.containsKey(%22w1.3%22));%0A        assertEquals(%22code%22, query10.keywords.get(%22w1.3%22));%0A        assertEquals(true, query10.formulae.containsKey(%22f1.0%22));%0A        Document testDoc = query10.formulae.get(%22f1.0%22);%0A        Node texExpression = XMLHelper.getElementB(testDoc, %22/math/semantics/annotation%22);%0A        assertEquals(%22f(%5C%5Cqvar%7Bx%7D)=%5C%5Cfrac%7B1%7D%7B%5C%5Csigma%5C%5Csqrt%7B2%5C%5Cpi%7D%7D%5C%5Cqvar%7Bz%7D%22, texExpression.getTextContent().trim());
 %0A    %7D%0A%7D

Add more tests