• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2007 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 
6 package org.mockito.internal.verification;
7 
8 import org.mockito.verification.VerificationMode;
9 
10 public class VerificationModeFactory {
11 
atLeastOnce()12     public static VerificationMode atLeastOnce() {
13         return atLeast(1);
14     }
15 
atLeast(int minNumberOfInvocations)16     public static VerificationMode atLeast(int minNumberOfInvocations) {
17         return new AtLeast(minNumberOfInvocations);
18     }
19 
only()20     public static VerificationMode only() {
21         return new Only(); //TODO make exception message nicer
22     }
23 
times(int wantedNumberOfInvocations)24     public static Times times(int wantedNumberOfInvocations) {
25         return new Times(wantedNumberOfInvocations);
26     }
27 
calls(int wantedNumberOfInvocations)28     public static Calls calls(int wantedNumberOfInvocations) {
29         return new Calls( wantedNumberOfInvocations );
30     }
31 
noMoreInteractions()32     public static NoMoreInteractions noMoreInteractions() {
33         return new NoMoreInteractions();
34     }
35 
atMost(int maxNumberOfInvocations)36     public static VerificationMode atMost(int maxNumberOfInvocations) {
37         return new AtMost(maxNumberOfInvocations);
38     }
39 
40     /**
41      * Verification mode will prepend the specified failure message if verification fails with the given implementation.
42      * @param mode Implementation used for verification
43      * @param description The custom failure message
44      * @return VerificationMode
45      * @since 2.1.0
46      */
description(VerificationMode mode, String description)47     public static VerificationMode description(VerificationMode mode, String description) {
48         return new Description(mode, description);
49     }
50 }
51