Established separate RTF exporter
Change-Id: I6baf90940d23eb178f7e18326b596c98e82e21ed
diff --git a/plugin/src/test/java/de/ids_mannheim/korap/plkexport/RtfExportTest.java b/plugin/src/test/java/de/ids_mannheim/korap/plkexport/RtfExportTest.java
new file mode 100644
index 0000000..436ba79
--- /dev/null
+++ b/plugin/src/test/java/de/ids_mannheim/korap/plkexport/RtfExportTest.java
@@ -0,0 +1,53 @@
+package de.ids_mannheim.korap.plkexport;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+
+import javax.ws.rs.core.Response;
+
+import de.ids_mannheim.korap.plkexport.JsonExporter;
+
+public class RtfExportTest {
+
+ @Test
+ public void testInit () throws IOException {
+ RtfExporter json = new RtfExporter();
+ json.init("{\"query\":\"cool\"}");
+
+ Response resp = json.serve().build();
+ String x = (String) resp.getEntity();
+ resp.close();
+ assertTrue(x.contains("{\\pard\\ql @ Institut"));
+ assertTrue(x.contains("Institut f\\u252\\'fcr Deutsche"));
+ };
+
+ @Test
+ public void testInitFull () throws IOException {
+ RtfExporter json = new RtfExporter();
+ json.init("{\"meta\":\"ja\",\"collection\":\"hm\",\"query\":\"cool\"," +
+ "\"matches\":["+
+ "{\"author\":\"Goethe\","+
+ "\"title\":\"Title1\","+
+ "\"pubDate\":\"20051103\","+
+ "\"snippet\":\"Simple <mark>match1</mark> Snippet\"}"+
+ ","+
+ "{\"author\":\"Schiller\","+
+ "\"title\":\"Title2\","+
+ "\"pubDate\":\"20051104\","+
+ "\"snippet\":\"Simpler <mark>match2</mark> Snippet\"}"+
+ "]}");
+
+ Response resp = json.serve().build();
+ String x = (String) resp.getEntity();
+ resp.close();
+ assertTrue(x.contains("{\\b match1}"));
+ assertTrue(x.contains("{\\b Title1"));
+ assertTrue(x.contains("{\\b Title2"));
+ };
+};