01 /*
02 * OldYamTranslatorTests.java
03 * Copyright (c) 1998-2008, The University of Sheffield.
04 *
05 * This code is from the GATE project (http://gate.ac.uk/) and is free
06 * software licenced under the GNU General Public License version 3. It is
07 * distributed without any warranty. For more details see COPYING.txt in the
08 * top level directory (or at http://gatewiki.sf.net/COPYING.txt).
09 *
10 * Hamish Cunningham, 2nd May 2006
11 */
12
13 package gate.yam.translate;
14
15 import java.io.*;
16 import junit.framework.*;
17 import gate.util.*;
18 import gate.wiki.antlr.*;
19
20
21 /**
22 * Unit test for OldYamTranslatorTests converter.
23 */
24 public class OldYamTranslatorTests extends gate.yam.AbstractTranslatorTest
25 {
26 /** Create the test case. */
27 public OldYamTranslatorTests(String testName) { super(testName); }
28
29 /** Paths of example test files. */
30 public String[] getTestFilePaths() {
31 String testFilePaths[] = {
32 "/old-yam-comprehensive",
33 "/old-yam-urls",
34 "/old-yam-minimal"
35 };
36 return testFilePaths;
37 }
38
39 /** Suffix of input files. */
40 public String getInputSuffix() { return "yam"; }
41
42 /** Suffix of output files. */
43 public String[] getOutputSuffixes() {
44 String outputSuffixes[] = {
45 "html" //, "tex"
46 };
47 return outputSuffixes;
48 }
49
50 /** Run the translator and get the response */
51 public Writer doTranslation(
52 Reader testReader, Writer responseWriter, String outputType,
53 String testName
54 ) throws Exception
55 {
56 if(outputType.equals("html"))
57 Tool.run(testReader, responseWriter, Tool.HTML);
58 else if(outputType.equals("tex"))
59 Tool.run(testReader, responseWriter, Tool.LATEX);
60 else
61 throw new GateException("unknown output type " + outputType);
62 return responseWriter;
63 }
64 }
|