gate.yam
Class YamTests

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by gate.yam.YamTests
All Implemented Interfaces:
junit.framework.Test

public class YamTests
extends junit.framework.TestCase

Unit test for the YamFile class.


Constructor Summary
YamTests(String testName)
          Create the test case
 
Method Summary
 void testContextPath()
          Test a translation from yam to html out of context.
 void testFileTypes()
          Test the file types enum.
 void testFSTranslate()
          Test file-system translate method.
 void testHtmlToYamNoIncludes()
          Test HtmlToYamConverter, using an html file generated with no includes processing.
 void testNoIncludes()
          Test a translation of yam to html without processing includes.
 void testYamToHtmlToYam()
           Test a round trip translation from yam to html and back to yam.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

YamTests

public YamTests(String testName)
Create the test case

Method Detail

testFSTranslate

public void testFSTranslate()
                     throws Exception
Test file-system translate method. Takes yam-again.yam and generates an html file on disk from it, yam-again.html. Compares this with yam-minimal.html. The comparison assumes that yam-again.yam is a copy of yam-minimal.yam

Throws:
Exception

testContextPath

public void testContextPath()
                     throws Exception
Test a translation from yam to html out of context. Takes yam-again.yam, and writes it to a new disk file, yam-test*.yam. YAM statements are now out of their original context. Translates yam-test*.yam to yam-test*.html and compares this to yam-minimal.html.

Throws:
Exception

testFileTypes

public void testFileTypes()
                   throws Exception
Test the file types enum.

Throws:
Exception

testHtmlToYamNoIncludes

public void testHtmlToYamNoIncludes()
                             throws Exception

Test HtmlToYamConverter, using an html file generated with no includes processing. Takes the file yam-minimal-no-includes.html, and converts to yam im memory. Compares this in-memory yam with a disk copy of yam-minimal.yam.

If there is a difference between the original and resultant yam, then the resultant yam will be output to yam-again.yam-conversion-fault Results can be viewed by e.g:

tkdiff yam-minimal-no-includes.yam-conversion-fault \ test/resources/yam/yam-minimal.yam &

Throws:
Exception

testYamToHtmlToYam

public void testYamToHtmlToYam()
                        throws Exception

Test a round trip translation from yam to html and back to yam. Takes the file yam-again.yam and copies to yam-test.*.yam. Translates this to yam-test*.html on disk. Converts yam-test*.html to yam in memory. Compares this back to yam-again.yam.

There is some repetition of to other methods, and this method could instead make use of files output form those other methods (e.g. take a html file already generated from yam in a previous test). However, keeping this test separate keeps the intention clear and isolates it from changes to other tests.

If there is a difference between the original and resultant yam, then the resultant yam will be output and can be viewed with e.g. tkdiff. The intermediate html may also be viewed.

Throws:
Exception

testNoIncludes

public void testNoIncludes()
                    throws Exception
Test a translation of yam to html without processing includes. Takes yam-again.yam and copies to the disk file yam-test*.yam. Translates this to yam-test*.html without processing includes, and compares this to yam-minimal-no-includes.html.

Throws:
Exception