suvi.parse
Class GraphParserTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--suvi.parse.GraphParserTest
All Implemented Interfaces:
junit.framework.Test

public class GraphParserTest
extends junit.framework.TestCase

A [JUnit] test for GraphParser.

Each parser test case functions by creating a StringReader from a string, a lexer based on the reader and a parser based on the lexer. Then the test case calls the parser's parse method and checks whether there was a syntax error exception - if no exception was expected, the test fails; if an exception was expected and there was none, the test fails; otherwise it succeeds (unless there was an unexpected exception, i.e. a non-syntax-error exception.


Constructor Summary
GraphParserTest()
           
 
Method Summary
 void testErrSyntax(java.lang.String s)
          A helper method for the invalid syntax tests A syntax error exception is expected.
 void testForgottenSemi()
          Test for invalid syntax: no semicolon at the end of an adjacency list item.
 void testOkFull()
          Test for valid syntax, with all optional parts in.
 void testOkNoAttrList()
          Test for valid syntax, with the optional node and edge attribute part out.
 void testOkNoGraphAttr()
          Test for valid syntax, with the optional global attribute part out.
 void testOkOnlyTopology()
          Test for valid syntax, with only the required topology part in.
 void testOkSyntax(java.lang.String s)
          A helper method for the valid syntax tests.
 void testWithSemi()
          Test for valid syntax; identical with the testForgottenSemi test case but with the forgotten semicolon back in.
static void tryParse(java.lang.String s)
          A helper method to create the parser from a string and trying the parse.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphParserTest

public GraphParserTest()
Method Detail

testOkFull

public void testOkFull()

Test for valid syntax, with all optional parts in.


testOkNoGraphAttr

public void testOkNoGraphAttr()

Test for valid syntax, with the optional global attribute part out.


testOkNoAttrList

public void testOkNoAttrList()

Test for valid syntax, with the optional node and edge attribute part out.


testOkOnlyTopology

public void testOkOnlyTopology()

Test for valid syntax, with only the required topology part in.


testForgottenSemi

public void testForgottenSemi()

Test for invalid syntax: no semicolon at the end of an adjacency list item.


testWithSemi

public void testWithSemi()

Test for valid syntax; identical with the testForgottenSemi test case but with the forgotten semicolon back in.


testOkSyntax

public void testOkSyntax(java.lang.String s)

A helper method for the valid syntax tests.

No exceptions are expected.


testErrSyntax

public void testErrSyntax(java.lang.String s)

A helper method for the invalid syntax tests

A syntax error exception is expected. Other exceptions cause a failure.


tryParse

public static void tryParse(java.lang.String s)

A helper method to create the parser from a string and trying the parse.