Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## xjavadoc.codeunit
Class CodeTestCase

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              xjavadoc.codeunit.CodeTestCase

All Implemented Interfaces:
  junit.framework.Test

public abstract class CodeTestCase
extends junit.framework.TestCase

CodeTestCase is a JUnit extension that will let you compare two sources (typically one we keep as test data and a generated one) on the API level or on the abstract syntax tree (AST) level. This is a lot more powerful than comparing on a character by character basis, because it's only "what matters" that is compared.

Author:
  Aslak Hellesøy

Constructor Summary
`CodeTestCase()`

Method Summary
`static void` | `assertApiEquals(File expected, File actual)` Asserts (tests) that the APIs of two sources are equal.
`static void` | `assertApiEquals(Reader expected, Reader actual)`
`static void` | `assertAstEquals(File expected, File actual)` Asserts (tests) that the ASTs of two sources are equal.
`static void` | `assertAstEquals(Reader expected, Reader actual)`
`static void` | `assertAstEqualsDir(File expectedDir, File actualDir)`
`static void` | `assertEquals(File expected, File actual)` Compares both API and AST.
`static void` | `assertEquals(Reader expected, Reader actual)`
`protected File` | `getDir()` Returns the directory where this class is located, provided that it's not in a jar.
`protected File` | `getRootDir()` Returns the root directory of the package hierarchy where this class is located, provided that it's not in a jar.
`protected XJavaDoc` | `getXJavaDoc()`

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

### CodeTestCase

    public CodeTestCase()

Method Detail

### assertAstEqualsDir

    public static void assertAstEqualsDir(File expectedDir,
                                          File actualDir)

### assertEquals

    public static void assertEquals(File expected,
                                    File actual)

  Compares both API and AST. Equivalent to calling `assertAstEquals(java.io.File, java.io.File)` and `assertApiEquals(java.io.File, java.io.File)`.

  Parameters:
    `expected` - the expected source
    `actual` - the actual source

### assertEquals

    public static void assertEquals(Reader expected,
                                    Reader actual)

### assertAstEquals

    public static void assertAstEquals(File expected,
                                       File actual)

  Asserts (tests) that the ASTs of two sources are equal. Does not compare the contents (tokens) of the nodes, and is forgiving with respect to those.

  Parameters:
    `expected` - the expected source
    `actual` - the actual source

### assertAstEquals

    public static void assertAstEquals(Reader expected,
                                       Reader actual)

### assertApiEquals

    public static void assertApiEquals(File expected,
                                       File actual)

  Asserts (tests) that the APIs of two sources are equal. Does not go into the method bodies to see if the implementation is equal, and is therefore more relaxed than assertAstEquals.

  Parameters:
    `expected` - the expected source
    `actual` - the actual source

### assertApiEquals

    public static void assertApiEquals(Reader expected,
                                       Reader actual)

### getDir

    protected File getDir()

  Returns the directory where this class is located, provided that it's not in a jar. This is very useful for accessing the files you want to compare.

  Returns:
    the directory where this class is located.

### getRootDir

    protected File getRootDir()

  Returns the root directory of the package hierarchy where this class is located, provided that it's not in a jar. This is very useful for accessing the files you want to compare.

  Returns:
    the root directory.

### getXJavaDoc

    protected XJavaDoc getXJavaDoc()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2004 XDoclet Team. All Rights Reserved.