Package randoop.test

Interface Check

All Known Implementing Classes:
EmptyExceptionCheck, ExceptionCheck, ExpectedExceptionCheck, InvalidExceptionCheck, InvalidValueCheck, MissingExceptionCheck, NoExceptionCheck, ObjectCheck, PostConditionCheck

public interface Check
A Check represents the expected runtime behavior of a Sequence, at a particular offset. For example, a client might add a NotNull check to the ith index of a sequence to signify that the value returned by the statement at index i should not be null.

When a unit test is run as a regression test, it should have the same behavior as it did previously, and the Check objects represent that previous, expected behavior. Some examples of Checks are:

The visitor classes decorate a sequence with Check objects. A Check object is inserted as a decoration on a specific index of an ExecutableSequence. Thus, a check is always associated with a specific index in a sequence. A check at index i means that the check is to be performed after statement i finishes executing.

A check implements two methods that specify the code to be emitted before and/or after a statement in a Sequence is executed.

A check may require some code to be emitted before and/or after the statement is printed. For example, a check for checking that x is not null after the statement "Foo x = m()" is executed might emit the assertion code "assertNotNull(x); ", and would do so after the statement is printed. As a second example, a check for checking that an expected exception is thrown by a statement would need to emit something like "try {" before the statement, and the catch clause after the statement.

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a string of Java source code to be emitted after a statement containing this check.
    Returns a string of Java source code to be emitted before a statement containing this check.
  • Method Details

    • toCodeStringPreStatement

      String toCodeStringPreStatement()
      Returns a string of Java source code to be emitted before a statement containing this check.
      Returns:
      the string to be included before the statement
    • toCodeStringPostStatement

      String toCodeStringPostStatement()
      Returns a string of Java source code to be emitted after a statement containing this check.
      Returns:
      the string to be included following the statement