gate.yam.depend
Class DependenciesTests

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

public class DependenciesTests
extends junit.framework.TestCase

Tests for Dependencies

Author:
Angus Roberts

Constructor Summary
DependenciesTests(String testName)
          Create a Dependencies test case
 
Method Summary
protected  void setUp()
          Set up the tests for Dependencies
 String shorthandToPaths(String str)
          Replace all file numbers in str with the equivalent canonical paths in yamFileNameMap.
static junit.framework.Test suite()
          Suite of tests for Dependencies
 void testCreateAndBasics()
          Test a few Dependencies basics: equality, hashCode, YamFile creation and removal.
 void testDelete()
          Test Dependencies YamFile deletion
 void testDelete2()
          Test Dependencies - further YamFile deletion tests
 void testModify()
          Test Dependencies YamFile modification
 void testNonYamChanges()
          Test Dependencies File creation, deletion, and renaming
 void testNonYamLinks()
          Test links to non-yam files and urls
 void testRename()
          Test Dependencies YamFile renaming
 void testSerialization()
          Test Dependencies serialization
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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

DependenciesTests

public DependenciesTests(String testName)
Create a Dependencies test case

Parameters:
testName - The name of the test
Method Detail

setUp

protected void setUp()
Set up the tests for Dependencies

Overrides:
setUp in class junit.framework.TestCase

testCreateAndBasics

public void testCreateAndBasics()
                         throws Exception
Test a few Dependencies basics: equality, hashCode, YamFile creation and removal.

Throws:
Exception - if the test fails

testDelete

public void testDelete()
                throws Exception
Test Dependencies YamFile deletion

Throws:
Exception - if the test fails

testRename

public void testRename()
                throws Exception
Test Dependencies YamFile renaming

Throws:
Exception - if the test fails

testDelete2

public void testDelete2()
                 throws Exception
Test Dependencies - further YamFile deletion tests

Throws:
Exception - if the test fails

testModify

public void testModify()
                throws Exception
Test Dependencies YamFile modification

Throws:
Exception - if the test fails

testNonYamLinks

public void testNonYamLinks()
                     throws Exception
Test links to non-yam files and urls

Throws:
Exception - if the test fails

testNonYamChanges

public void testNonYamChanges()
                       throws Exception
Test Dependencies File creation, deletion, and renaming

Throws:
Exception - if the test fails

testSerialization

public void testSerialization()
                       throws Exception
Test Dependencies serialization

Throws:
Exception - if the test fails

suite

public static junit.framework.Test suite()
Suite of tests for Dependencies

Returns:
The suite of tests

shorthandToPaths

public String shorthandToPaths(String str)

Replace all file numbers in str with the equivalent canonical paths in yamFileNameMap. All files used in Dependencies testing are named by convention as "yam-depends-\d+.yam". Dependencies will report its internal state graphs in the form "pathA:[pathB,pathC];pathB[pathD]", where pathX is the canonical path of a file.

For test files, we can refer to a Dependencies graph in a shorthand form using just the digit part of the test name, e.g. "1:[2,3];2[4]" and then translate this to full canonical paths using this method.

Non-yam files are referred to by their path relative to their linking node. They are replaced by their full canonical path. For example, "1:[some-file.html]", where some-file is not from yam, will become "/parent/path/yam-depends-1.yam:[/parent/path/some-file.html]"

Parameters:
str - A string in which we want to replace numbers with test file canonical paths
Returns:
The equivalent string with numbers replaced by test file canonical paths