Interface VerificationAfterDelay

  • All Superinterfaces:
    VerificationMode
    All Known Implementing Classes:
    After

    public interface VerificationAfterDelay
    extends VerificationMode
    VerificationAfterDelay is a VerificationMode that allows combining existing verification modes with an initial delay, e.g.
    
     verify(mock, after(100).atMost(5)).foo();
    
     verify(mock, after(100).never()).bar();
    
     verify(mock, after(200).atLeastOnce()).baz();
     
    This is similar to timeout() except the assertion will not terminate until either the condition is definitively failed, or the full time has elapsed (whereas timeout() will also stop if the conditions is true at any point, as is typically the case with never() etc initially).

    See examples in javadoc for Mockito.verify(Object, VerificationMode)

    • Method Detail

      • times

        VerificationMode times​(int wantedNumberOfInvocations)
        Verifies that there are exactly N invocations during the given period. This will wait the full period given.
      • never

        VerificationMode never()
        Allows verification that there are no invocations at any point during the given period. This will wait the full period given, unless an invocation occurs (in which case there will be immediate failure)
      • atLeastOnce

        VerificationMode atLeastOnce()
        Verifies that there is at least 1 invocation during the given period. This will wait the full period given.
      • atLeast

        VerificationMode atLeast​(int minNumberOfInvocations)
        Verifies that there is are least N invocations during the given period. This will wait the full period given.
      • atMostOnce

        VerificationMode atMostOnce()
        Verifies that there is most 1 invocation during the given period. This will wait the full period given, unless too many invocations occur (in which case there will be an immediate failure)
      • atMost

        VerificationMode atMost​(int maxNumberOfInvocations)
        Verifies that there is are most N invocations during the given period. This will wait the full period given, unless too many invocations occur (in which case there will be an immediate failure)
      • only

        VerificationMode only()
        Verifies that there the given method is invoked and is the only method invoked. This will wait the full period given, unless another method is invoked (in which case there will be an immediate failure)