Class ThrowsCondition

java.lang.Object
randoop.condition.specification.SpecificationClause
randoop.condition.specification.ThrowsCondition

public class ThrowsCondition extends SpecificationClause
A specification clause that an exception should be thrown.

The JSON serialization of this class is used to read the specifications for an operation given using the --specifications command-line option. The JSON should include a JSON object labeled by the name of each field of this class, as in

   {
      "exception": "java.lang.IllegalStateException",
      "description": "throws IllegalStateException if the connection is already open",
      "guard": {
         "condition": "receiver.isOpen()",
         "description": "if the connection is already open"
       }
   }
 
See Guard for details on specifying guards.
  • Field Details

    • exceptionType

      @SerializedName("exception") private final @ClassGetName String exceptionType
      The fully-qualified binary name of the type of the expected exception.
  • Constructor Details

    • ThrowsCondition

      private ThrowsCondition()
      Gson serialization requires a default constructor.
    • ThrowsCondition

      public ThrowsCondition(String description, Guard guard, @ClassGetName String exceptionType)
      Creates a ThrowsCondition representing an exception expected when the guard is true.
      Parameters:
      description - the description of the condition
      guard - the guard for the specification
      exceptionType - the expected exception type
  • Method Details