Package randoop.test

Class NoExceptionCheck

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

public class NoExceptionCheck extends Object implements 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 Details

    • statementIdx

      private final int statementIdx
      Indicates which statement is expected to return normally.
    • exceptionName

      private String 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

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

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

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