Package randoop.test
Class NoExceptionCheck
java.lang.Object
randoop.test.NoExceptionCheck
- All Implemented Interfaces:
Check
This check represents the fact that a statement should not throw any exception.
It is used in an error-revealing test to indicate that an exception that is considered to be an error (e.g., not "expected" or "invalid") was thrown by the statement during test generation. Only a comment is included when the test is output noting the occurrence of the exception during test generation, though the statement is expected to throw the method when the error-revealing test is run.
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
The exception that the statement threw during generation.private final int
Indicates which statement is expected to return normally. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
Returns the empty string: there is no code associated with this check (if an exception occurs, it will be reported by JUnit).Returns a string of Java source code to be emitted before a statement containing this check.
-
Field Details
-
statementIdx
private final int statementIdxIndicates which statement is expected to return normally. -
exceptionName
The exception that the statement threw during generation. Used only in a comment in the generated code -- the contract of NoExceptionCheck is that no exception should be thrown, whether or not it's the same as what was observed during generation.
-
-
Constructor Details
-
NoExceptionCheck
NoExceptionCheck(int statementIdx, String exceptionName)
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
toCodeStringPostStatement
Returns the empty string: there is no code associated with this check (if an exception occurs, it will be reported by JUnit).- Specified by:
toCodeStringPostStatement
in interfaceCheck
- Returns:
- the string to be included following the statement
-
toCodeStringPreStatement
Description copied from interface:Check
Returns a string of Java source code to be emitted before a statement containing this check.- Specified by:
toCodeStringPreStatement
in interfaceCheck
- Returns:
- the string to be included before the statement
-