|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jmlspecs.jmlunit.TestClassGenerator
org.jmlspecs.jmlunit.TestDataClassGenerator
A class for generating JML/JUnit test data classes. A test data class
must be used to specify test data for a JML/JUnit test oracle class
generated by the class TestClassGenerator.
| Nested Class Summary |
| Nested classes inherited from class org.jmlspecs.jmlunit.TestClassGenerator |
TestClassGenerator.MethodInfo, TestClassGenerator.MethodsIterator |
| Field Summary |
| Fields inherited from class org.jmlspecs.jmlunit.TestClassGenerator |
fixtureTypes, generatorClassName, generatorPackageName, includeInherited, packageString, testClassName, testedPackageString, typeDecl, useGenerator |
| Fields inherited from interface org.jmlspecs.jmlunit.Constants |
DOT_JAVA, PKG_JMLRAC, PKG_JMLUNIT, PKG_JUNIT, PKG_STRATEGIES, TEST_CLASS_FILE_NAME_POSTFIX, TEST_CLASS_NAME_POSTFIX, TEST_DATA_FILE_NAME_POSTFIX, TEST_DATA_NAME_POSTFIX, TEST_METHOD_NAME_PREFIX |
| Constructor Summary | |
TestDataClassGenerator(JntOptions options)
Constructs a new test data class generator object. |
|
| Method Summary | |
static String |
defaultValue(CType type)
Returns the default value of the type type. |
private CExpressionContextType |
expr_context(CClass selfClass)
Compute a context for use in testing whether a method exists in the given class. |
protected void |
generateTestClass(JCompilationUnit cunit,
JTypeDeclarationType cdecl)
Generates a test data class for the given class, cdecl. |
boolean |
hasCloneMethod(CClass selfClass)
Does the given CClass have a clone method? |
protected void |
initializeFixture()
Initialize the fixture to contain all of the types used as paramaeters in all the methods. |
private boolean |
isImmutableType(CType type,
String typeName)
Is the given type an immutable type? |
private void |
print_get_X_MethodDecl(String varName,
String typeName,
String defaultValue,
boolean isImmutableType,
boolean hasCloneMethod)
Prints the declaration of the get_X method. |
private void |
print_size_X_MethodDecl(String varName,
String typeName,
boolean isImmutableType,
boolean hasCloneMethod)
Prints the declaration of the size_X method. |
protected void |
printBigComment()
Print the big comment in the body explaining how to edit the code to provide test data. |
protected void |
printClassHeader()
Prints the class header of test case class. |
protected void |
printClassJavadoc()
Prints a javadoc comment for the current class. |
private void |
printDataProvisionCode(CType type)
Prints the declaration of the vTiter method as well as the sample strategy for the given type. |
protected void |
printDataProvisionMethods()
Prints declarations of the vTiter methods, as well as sample strategy declarations for. |
private void |
printEmptyTestSuiteForMethod()
Print the declaration of the emptyTestSuiteFor method. |
protected void |
printImportStatements(JCompilationUnit cunit)
Prints import statements. |
private void |
printIteratorProvisionMethod(String varName,
String typeName,
boolean isPrimitive,
boolean isImmutableType,
boolean hasCloneMethod)
Print the declaration of the vTiter method for the given type. |
private void |
printOverallTestSuiteMethod()
Print the declaration of the overallTestSuite method. |
private void |
printProvideIteratorComment(String typeName)
|
private void |
printStrategyGuess(CType type,
String varName,
String typeName,
boolean isPrimitive,
boolean isImmutable,
boolean hasCloneMethod)
Print the declaration of the default strategy for the given type. |
protected void |
printSuiteFactoryMethods()
Print the factory method declarations. |
| Methods inherited from class org.jmlspecs.jmlunit.TestClassGenerator |
capitalize, composeFailMessage, fixtureVariableName, getPackageString, getTestedPackageString, indent, isStatic, methodsIter, newLine, perform, print, print, printConstructor, printFileHeader, println, printlnIn, printMain, printSuite, undent |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TestDataClassGenerator(JntOptions options)
| Method Detail |
protected void printImportStatements(JCompilationUnit cunit)
printImportStatements in class TestClassGeneratorprotected void printClassJavadoc()
printClassJavadoc in class TestClassGenerator
protected void generateTestClass(JCompilationUnit cunit,
JTypeDeclarationType cdecl)
cdecl.
This method is overridden here to generate a data case class
instead of a test oracle class.
generateTestClass in class TestClassGeneratorprotected void printClassHeader()
printClassHeader in class TestClassGeneratorprotected void printSuiteFactoryMethods()
private void printOverallTestSuiteMethod()
private void printEmptyTestSuiteForMethod()
protected void printBigComment()
protected void initializeFixture()
TestClassGenerator
initializeFixture in class TestClassGeneratorprotected void printDataProvisionMethods()
private void printDataProvisionCode(CType type)
private void printIteratorProvisionMethod(String varName,
String typeName,
boolean isPrimitive,
boolean isImmutableType,
boolean hasCloneMethod)
private void printProvideIteratorComment(String typeName)
private void printStrategyGuess(CType type,
String varName,
String typeName,
boolean isPrimitive,
boolean isImmutable,
boolean hasCloneMethod)
private void print_size_X_MethodDecl(String varName,
String typeName,
boolean isImmutableType,
boolean hasCloneMethod)
private void print_get_X_MethodDecl(String varName,
String typeName,
String defaultValue,
boolean isImmutableType,
boolean hasCloneMethod)
private boolean isImmutableType(CType type,
String typeName)
private CExpressionContextType expr_context(CClass selfClass)
public boolean hasCloneMethod(CClass selfClass)
public static String defaultValue(CType type)
type. I.e.,
0 for numerical types, false for boolean, empty array for array
types, and null for other types.
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||