com.thoughtworks.qdox.junit
Class APITestCase
TestCase
com.thoughtworks.qdox.junit.APITestCase
public abstract class APITestCase
extends TestCase
APITestCase is a JUnit extension that will let you compare two sources
(typically one kept as a static expected result and a generated one) on the API level.
This class has been ported from XJavaDoc's CodeTestCase, carrying over only the
parts that compare on the API level. The original CodeTestCase also has comparison
of Java source AST (Abstract Syntax Trees). This will probably be extracted into
a ASTTestCase class and hosted as a separate project somewhere else. It should
probably be based on JavaCC for ease of porting.
- Aslak Hellesøy
- Laurent Etiemble
static void | assertApiEquals(URL expected, URL actual) - Compares API of both sources in the readers.
|
private static void | assertApiEquals(JavaSource expected, JavaSource actual) - Compares API of both JavaSource objects.
|
private static void | assertClassesEqual(JavaClass expected, JavaClass actual) - Compares an actual field to an expected one.
|
private static void | assertFieldEquals(JavaField expected, JavaField actual) - Compares an actual field to an expected one.
|
private static void | assertFieldsEqual(JavaClass expected, JavaClass actual) - Compares fields from an actual class to an expected one.
|
private static void | assertInnerClassesEquals(JavaClass expected, JavaClass actual) - Compares inner classes from an actual class to an expected one.
|
private static void | assertInterfacesEqual(JavaClass expected, JavaClass actual) - Compares implemented interfaces from an actual class to an expected one.
|
private static void | assertMethodsEqual(JavaClass expected, JavaClass actual) - Compares constructors and methods from an actual class to an expected one.
|
private static void | assertModifiersEquals(String msg, AbstractJavaEntity expected, AbstractJavaEntity actual) - Compares modifiers an actual entity.
|
private static void | assertNotDir(File expected, File actual)
|
protected File | getDir()
|
protected File | getRootDir()
|
ENTITY_COMPARATOR
private static Comparator ENTITY_COMPARATOR
APITestCase
public APITestCase()
assertApiEquals
public static void assertApiEquals(URL expected,
URL actual)
throws IOException
Compares API of both sources in the readers.
Note: This method is for backward naming compatiblity
with xjavadoc.codeunit.CodeTestCase.
expected
- the expected sourceactual
- the actual source
assertApiEquals
private static void assertApiEquals(JavaSource expected,
JavaSource actual)
Compares API of both JavaSource objects.
expected
- the expected sourceactual
- the actual source
assertClassesEqual
private static void assertClassesEqual(JavaClass expected,
JavaClass actual)
Compares an actual field to an expected one.
As JavaClass doesn't not implements
equals
and
hashCode
methods, the comparison is done by hand.
assertFieldEquals
private static void assertFieldEquals(JavaField expected,
JavaField actual)
Compares an actual field to an expected one.
As JavaField doesn't not implements
equals
and
hashCode
methods, the comparison is done by hand.
assertFieldsEqual
private static void assertFieldsEqual(JavaClass expected,
JavaClass actual)
Compares fields from an actual class to an expected one.
The fields are sorted by name before comparison to be sure
that even if the fields are defined in a different order, the
comparison is still right.
assertInnerClassesEquals
private static void assertInnerClassesEquals(JavaClass expected,
JavaClass actual)
Compares inner classes from an actual class to an expected one.
The inner classes are sorted by name before comparison to be sure
that even if the inner classes are defined in a different order, the
comparison is still right.
assertInterfacesEqual
private static void assertInterfacesEqual(JavaClass expected,
JavaClass actual)
Compares implemented interfaces from an actual class to an expected one.
The implemented interfaces are sorted by name before comparison to be sure
that even if the implemented interfaces are defined in a different order, the
comparison is still right.
assertMethodsEqual
private static void assertMethodsEqual(JavaClass expected,
JavaClass actual)
Compares constructors and methods from an actual class to an expected one.
The constructors and the methods are sorted by name before comparison to be sure
that even if the constructors and methods are defined in a different order, the
comparison is still right.
assertModifiersEquals
private static void assertModifiersEquals(String msg,
AbstractJavaEntity expected,
AbstractJavaEntity actual)
Compares modifiers an actual entity.
The modifiers are sorted by name before comparison to be sure
that even if the modifiers are defined in a different order, the
comparison is still right.
assertNotDir
private static void assertNotDir(File expected,
File actual)
getDir
protected File getDir()
getRootDir
protected File getRootDir()