Package randoop.test

Class ObjectCheck

java.lang.Object
randoop.test.ObjectCheck
All Implemented Interfaces:
Check

public class ObjectCheck extends Object implements Check
A check that checks for expected properties of one or more objects generated during the execution of a Sequence, for example:
  • Checking that the objects created during execution of a sequence respect reflexivity, transitivity and symmetry of equality.
  • Checking that calling toString() on the objects created during execution of a sequence does not throw an exception.

An ObjectCheck has two parts:

  • A ObjectContract responsible for performing the actual check on a set of runtime values. For example. the class EqualsReflexive is a checker code class that, given an object o, calls o.equals(o) and checks that it returns true.
  • A list of Variables, which describe the specific objects in the sequence that the check is over.
  • Field Details

    • contract

      private final ObjectContract contract
      The contract that is checked.
    • vars

      private final Variable[] vars
      The variables for the contract.
  • Constructor Details

    • ObjectCheck

      public ObjectCheck(ObjectContract contract, Variable... vars)
      Creates an ObjectCheck for the given contract using the variables as input.
      Parameters:
      contract - the contract to check
      vars - the input variables for the created check
  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toCodeStringPreStatement

      public String 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 interface Check
      Returns:
      the string to be included before the statement
    • toCodeStringPostStatement

      public String toCodeStringPostStatement()
      Description copied from interface: Check
      Returns a string of Java source code to be emitted after a statement containing this check.
      Specified by:
      toCodeStringPostStatement in interface Check
      Returns:
      the string to be included following the statement