Log in Help
Print
Homegatewikicowtestunitgateyamtranslate 〉 OldYamTranslatorTests.java
 
/*
 *  OldYamTranslatorTests.java
 *  Copyright (c) 1998-2008, The University of Sheffield.
 *
 *  This code is from the GATE project (http://gate.ac.uk/) and is free
 *  software licenced under the GNU General Public License version 3. It is
 *  distributed without any warranty. For more details see COPYING.txt in the
 *  top level directory (or at http://gatewiki.sf.net/COPYING.txt).
 *  
 *  Hamish Cunningham, 2nd May 2006
 */

package gate.yam.translate;

import java.io.*;
import junit.framework.*;
import gate.util.*;
import gate.wiki.antlr.*;


/**
 * Unit test for OldYamTranslatorTests converter.
 */
public class OldYamTranslatorTests extends gate.yam.AbstractTranslatorTest
{
  /** Create the test case. */
  public OldYamTranslatorTests(String testName) { super(testName); }

  /** Paths of example test files. */
  public String[] getTestFilePaths() {
    String testFilePaths[] = {
      "/old-yam-comprehensive",
      "/old-yam-urls",
      "/old-yam-minimal"
    };
    return testFilePaths;
  }

  /** Suffix of input files. */
  public String getInputSuffix() { return "yam"; }

  /** Suffix of output files. */
  public String[] getOutputSuffixes() {
    String outputSuffixes[] = {
      "html"  //, "tex"
    };
    return outputSuffixes;
  }

  /** Run the translator and get the response */
  public Writer doTranslation(
    Reader testReader, Writer responseWriter, String outputType,
    String testName
  ) throws Exception
  {
    if(outputType.equals("html"))
      Tool.run(testReader, responseWriter, Tool.HTML);
    else if(outputType.equals("tex"))
      Tool.run(testReader, responseWriter, Tool.LATEX);
    else
      throw new GateException("unknown output type " + outputType);
    return responseWriter;
  }
}