VerificationOverTimeImpl
Date: 2015-09-18

org.mockito.internal.verification

## Class VerificationOverTimeImpl

- java.lang.Object
- - org.mockito.internal.verification.VerificationOverTimeImpl

- All Implemented Interfaces:
    VerificationMode

      public class VerificationOverTimeImpl
      extends java.lang.Object
      implements VerificationMode

  Verifies that another verification mode (the delegate) is satisfied within a certain timeframe (before timeoutMillis has passed, measured from the call to verify()), and either returns immediately once it does, or waits until it is definitely satisfied once the full time has passed.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VerificationOverTimeImpl(long pollingPeriodMillis, long durationMillis, VerificationMode delegate, boolean returnOnSuccess)` Create this verification mode, to be used to verify invocation ongoing data later.
    `VerificationOverTimeImpl(long pollingPeriodMillis, long durationMillis, VerificationMode delegate, boolean returnOnSuccess, Timer timer)` Create this verification mode, to be used to verify invocation ongoing data later.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `canRecoverFromFailure(VerificationMode verificationMode)`
    `VerificationMode` | `getDelegate()`
    `long` | `getDuration()`
    `long` | `getPollingPeriod()`
    `void` | `verify(VerificationData data)` Verify the given ongoing verification data, and confirm that it satisfies the delegate verification mode before the full duration has passed.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VerificationOverTimeImpl

          public VerificationOverTimeImpl(long pollingPeriodMillis,
                                  long durationMillis,
                                  VerificationMode delegate,
                                  boolean returnOnSuccess)

      Create this verification mode, to be used to verify invocation ongoing data later.
      Parameters:
        `pollingPeriodMillis` - The frequency to poll delegate.verify(), to check whether the delegate has been satisfied
        `durationMillis` - The max time to wait (in millis) for the delegate verification mode to be satisfied
        `delegate` - The verification mode to delegate overall success or failure to
        `returnOnSuccess` - Whether to immediately return successfully once the delegate is satisfied (as in `VerificationWithTimeout`, or to only return once the delegate is satisfied and the full duration has passed (as in `VerificationAfterDelay`).

    - #### VerificationOverTimeImpl

          public VerificationOverTimeImpl(long pollingPeriodMillis,
                                  long durationMillis,
                                  VerificationMode delegate,
                                  boolean returnOnSuccess,
                                  Timer timer)

      Create this verification mode, to be used to verify invocation ongoing data later.
      Parameters:
        `pollingPeriodMillis` - The frequency to poll delegate.verify(), to check whether the delegate has been satisfied
        `durationMillis` - The max time to wait (in millis) for the delegate verification mode to be satisfied
        `delegate` - The verification mode to delegate overall success or failure to
        `returnOnSuccess` - Whether to immediately return successfully once the delegate is satisfied (as in `VerificationWithTimeout`, or to only return once the delegate is satisfied and the full duration has passed (as in `VerificationAfterDelay`).
        `timer` - Checker of whether the duration of the verification is still acceptable

  - ### Method Detail

    - #### verify

          public void verify(VerificationData data)

      Verify the given ongoing verification data, and confirm that it satisfies the delegate verification mode before the full duration has passed. In practice, this polls the delegate verification mode until it is satisfied. If it is not satisfied once the full duration has passed, the last error returned by the delegate verification mode will be thrown here in turn. This may be thrown early if the delegate is unsatisfied and the verification mode is known to never recover from this situation (e.g. `AtMost`). If it is satisfied before the full duration has passed, behaviour is dependent on the returnOnSuccess parameter given in the constructor. If true, this verification mode is immediately satisfied once the delegate is. If false, this verification mode is not satisfied until the delegate is satisfied and the full time has passed.
      Specified by:
        `verify` in interface `VerificationMode`
      Throws:
        `MockitoAssertionError` - if the delegate verification mode does not succeed before the timeout

    - #### canRecoverFromFailure

          protected boolean canRecoverFromFailure(VerificationMode verificationMode)

    - #### getPollingPeriod

          public long getPollingPeriod()

    - #### getDuration

          public long getDuration()

    - #### getDelegate

          public VerificationMode getDelegate()