Class ExpectationHandler

  • All Implemented Interfaces:
    AggregateExpectation, IndividualExpectation

    public class ExpectationHandler
    extends Object
    implements AggregateExpectation, IndividualExpectation
    DSL (Domain Specific Language) for expectation management. The goal is to allow checks on the truth value, results, and contents of specific calls. If expectations are active, a failed condition will raise an exception. If expectations are not active, no exception will be raised regardless of the truth value of the condition. WiP: A more finely grained mechanism for activation is planned. The goal is to allow activating and deactivating specific types of expectations.
    • Method Detail

      • expectationHandler

        public static ExpectationHandler expectationHandler()
        Returns:
        a DSL object to handle expectation operations.
      • that

        public IndividualExpectation that​(boolean active,
                                          boolean condition)
        Description copied from interface: IndividualExpectation
        An individual expectation from a call result.
        Specified by:
        that in interface IndividualExpectation
        Parameters:
        active - is the expectation active. If active, and the condition is false, an Exception will be raised.
        condition - is the condition to be checked. If the expectation is not [active], the truth value of the condition is not relevant. Additional functions can/will be developed.
      • that

        public IndividualExpectation that​(boolean active,
                                          Method method,
                                          Object[] args)
        Description copied from interface: IndividualExpectation
        An individual expectation from a call result.
        Specified by:
        that in interface IndividualExpectation
        Parameters:
        active - is the expectation active. If active, and the condition is false, an Exception will be raised.
        method - is should be invoked if active (and any other conditions are met). The idea is to allow the use of Hamcrest Matchers and Rest Assured assertions. Additional functions can/will be developed.