• 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;
7 
8 import static org.mockito.internal.progress.ThreadSafeMockingProgress.mockingProgress;
9 
10 import org.mockito.internal.matchers.ArrayEquals;
11 import org.mockito.internal.matchers.CompareEqual;
12 import org.mockito.internal.matchers.EqualsWithDelta;
13 import org.mockito.internal.matchers.Find;
14 import org.mockito.internal.matchers.GreaterOrEqual;
15 import org.mockito.internal.matchers.GreaterThan;
16 import org.mockito.internal.matchers.LessOrEqual;
17 import org.mockito.internal.matchers.LessThan;
18 
19 /**
20  * See {@link Matchers} for general info about matchers.
21  * <p>
22  * AdditionalMatchers provides rarely used matchers, kept only for somewhat compatibility with EasyMock.
23  * Use additional matchers very judiciously because they may impact readability of a test.
24  * It is recommended to use matchers from {@link Matchers} and keep stubbing and verification simple.
25  * <p>
26  * Example of using logical and(), not(), or() matchers:
27  *
28  * <pre class="code"><code class="java">
29  *   //anything but not "ejb"
30  *   mock.someMethod(not(eq("ejb")));
31  *
32  *   //not "ejb" and not "michael jackson"
33  *   mock.someMethod(and(not(eq("ejb")), not(eq("michael jackson"))));
34  *
35  *   //1 or 10
36  *   mock.someMethod(or(eq(1), eq(10)));
37  * </code></pre>
38  *
39  * Scroll down to see all methods - full list of matchers.
40  */
41 @SuppressWarnings("ALL")
42 public class AdditionalMatchers {
43 
44     /**
45      * argument greater than or equal the given value.
46      * <p>
47      * See examples in javadoc for {@link AdditionalMatchers} class
48      *
49      * @param value
50      *            the given value.
51      * @return <code>null</code>.
52      */
geq(T value)53     public static <T extends Comparable<T>> T geq(T value) {
54         reportMatcher(new GreaterOrEqual<T>(value));
55         return null;
56     }
57 
58     /**
59      * byte argument greater than or equal to the given value.
60      * <p>
61      * See examples in javadoc for {@link AdditionalMatchers} class
62      *
63      * @param value
64      *            the given value.
65      * @return <code>0</code>.
66      */
geq(byte value)67     public static byte geq(byte value) {
68         reportMatcher(new GreaterOrEqual<Byte>(value));
69         return 0;
70     }
71 
72     /**
73      * double argument greater than or equal to the given value.
74      * <p>
75      * See examples in javadoc for {@link AdditionalMatchers} class
76      *
77      * @param value
78      *            the given value.
79      * @return <code>0</code>.
80      */
geq(double value)81     public static double geq(double value) {
82         reportMatcher(new GreaterOrEqual<Double>(value));
83         return 0;
84     }
85 
86     /**
87      * float argument greater than or equal to the given value.
88      * <p>
89      * See examples in javadoc for {@link AdditionalMatchers} class
90      *
91      * @param value
92      *            the given value.
93      * @return <code>0</code>.
94      */
geq(float value)95     public static float geq(float value) {
96         reportMatcher(new GreaterOrEqual<Float>(value));
97         return 0;
98     }
99 
100     /**
101      * int argument greater than or equal to the given value.
102      * <p>
103      * See examples in javadoc for {@link AdditionalMatchers} class
104      *
105      * @param value
106      *            the given value.
107      * @return <code>0</code>.
108      */
geq(int value)109     public static int geq(int value) {
110         reportMatcher(new GreaterOrEqual<Integer>(value));
111         return 0;
112     }
113 
114     /**
115      * long argument greater than or equal to the given value.
116      * <p>
117      * See examples in javadoc for {@link AdditionalMatchers} class
118      *
119      * @param value
120      *            the given value.
121      * @return <code>0</code>.
122      */
geq(long value)123     public static long geq(long value) {
124         reportMatcher(new GreaterOrEqual<Long>(value));
125         return 0;
126     }
127 
128     /**
129      * short argument greater than or equal to the given value.
130      * <p>
131      * See examples in javadoc for {@link AdditionalMatchers} class
132      *
133      * @param value
134      *            the given value.
135      * @return <code>0</code>.
136      */
geq(short value)137     public static short geq(short value) {
138         reportMatcher(new GreaterOrEqual<Short>(value));
139         return 0;
140     }
141 
142     /**
143      * comparable argument less than or equal the given value details.
144      * <p>
145      * See examples in javadoc for {@link AdditionalMatchers} class
146      *
147      * @param value
148      *            the given value.
149      * @return <code>null</code>.
150      */
leq(T value)151     public static <T extends Comparable<T>> T leq(T value) {
152         reportMatcher(new LessOrEqual<T>(value));
153         return null;
154     }
155 
156     /**
157      * byte argument less than or equal to the given value.
158      * <p>
159      * See examples in javadoc for {@link AdditionalMatchers} class
160      *
161      * @param value
162      *            the given value.
163      * @return <code>0</code>.
164      */
leq(byte value)165     public static byte leq(byte value) {
166         reportMatcher(new LessOrEqual<Byte>(value));
167         return 0;
168     }
169 
170     /**
171      * double argument less than or equal to the given value.
172      * <p>
173      * See examples in javadoc for {@link AdditionalMatchers} class
174      *
175      * @param value
176      *            the given value.
177      * @return <code>0</code>.
178      */
leq(double value)179     public static double leq(double value) {
180         reportMatcher(new LessOrEqual<Double>(value));
181         return 0;
182     }
183 
184     /**
185      * float argument less than or equal to the given value.
186      * <p>
187      * See examples in javadoc for {@link AdditionalMatchers} class
188      *
189      * @param value
190      *            the given value.
191      * @return <code>0</code>.
192      */
leq(float value)193     public static float leq(float value) {
194         reportMatcher(new LessOrEqual<Float>(value));
195         return 0;
196     }
197 
198     /**
199      * int argument less than or equal to the given value.
200      * <p>
201      * See examples in javadoc for {@link AdditionalMatchers} class
202      *
203      * @param value
204      *            the given value.
205      * @return <code>0</code>.
206      */
leq(int value)207     public static int leq(int value) {
208         reportMatcher(new LessOrEqual<Integer>(value));
209         return 0;
210     }
211 
212     /**
213      * long argument less than or equal to the given value.
214      * <p>
215      * See examples in javadoc for {@link AdditionalMatchers} class
216      *
217      * @param value
218      *            the given value.
219      * @return <code>0</code>.
220      */
leq(long value)221     public static long leq(long value) {
222         reportMatcher(new LessOrEqual<Long>(value));
223         return 0;
224     }
225 
226     /**
227      * short argument less than or equal to the given value.
228      * <p>
229      * See examples in javadoc for {@link AdditionalMatchers} class
230      *
231      * @param value
232      *            the given value.
233      * @return <code>0</code>.
234      */
leq(short value)235     public static short leq(short value) {
236         reportMatcher(new LessOrEqual<Short>(value));
237         return 0;
238     }
239 
240     /**
241      * comparable argument greater than the given value.
242      * <p>
243      * See examples in javadoc for {@link AdditionalMatchers} class
244      *
245      * @param value
246      *            the given value.
247      * @return <code>null</code>.
248      */
gt(T value)249     public static <T extends Comparable<T>> T gt(T value) {
250         reportMatcher(new GreaterThan<T>(value));
251         return null;
252     }
253 
254     /**
255      * byte argument greater than the given value.
256      * <p>
257      * See examples in javadoc for {@link AdditionalMatchers} class
258      *
259      * @param value
260      *            the given value.
261      * @return <code>0</code>.
262      */
gt(byte value)263     public static byte gt(byte value) {
264         reportMatcher(new GreaterThan<Byte>(value));
265         return 0;
266     }
267 
268     /**
269      * double argument greater than the given value.
270      * <p>
271      * See examples in javadoc for {@link AdditionalMatchers} class
272      *
273      * @param value
274      *            the given value.
275      * @return <code>0</code>.
276      */
gt(double value)277     public static double gt(double value) {
278         reportMatcher(new GreaterThan<Double>(value));
279         return 0;
280     }
281 
282     /**
283      * float argument greater than the given value.
284      * <p>
285      * See examples in javadoc for {@link AdditionalMatchers} class
286      *
287      * @param value
288      *            the given value.
289      * @return <code>0</code>.
290      */
gt(float value)291     public static float gt(float value) {
292         reportMatcher(new GreaterThan<Float>(value));
293         return 0;
294     }
295 
296     /**
297      * int argument greater than the given value.
298      * <p>
299      * See examples in javadoc for {@link AdditionalMatchers} class
300      *
301      * @param value
302      *            the given value.
303      * @return <code>0</code>.
304      */
gt(int value)305     public static int gt(int value) {
306         reportMatcher(new GreaterThan<Integer>(value));
307         return 0;
308     }
309 
310     /**
311      * long argument greater than the given value.
312      * <p>
313      * See examples in javadoc for {@link AdditionalMatchers} class
314      *
315      * @param value
316      *            the given value.
317      * @return <code>0</code>.
318      */
gt(long value)319     public static long gt(long value) {
320         reportMatcher(new GreaterThan<Long>(value));
321         return 0;
322     }
323 
324     /**
325      * short argument greater than the given value.
326      * <p>
327      * See examples in javadoc for {@link AdditionalMatchers} class
328      *
329      * @param value
330      *            the given value.
331      * @return <code>0</code>.
332      */
gt(short value)333     public static short gt(short value) {
334         reportMatcher(new GreaterThan<Short>(value));
335         return 0;
336     }
337 
338     /**
339      * comparable argument less than the given value.
340      * <p>
341      * See examples in javadoc for {@link AdditionalMatchers} class
342      *
343      * @param value
344      *            the given value.
345      * @return <code>null</code>.
346      */
lt(T value)347     public static <T extends Comparable<T>> T lt(T value) {
348         reportMatcher(new LessThan<T>(value));
349         return null;
350     }
351 
352     /**
353      * byte argument less than the given value.
354      * <p>
355      * See examples in javadoc for {@link AdditionalMatchers} class
356      *
357      * @param value
358      *            the given value.
359      * @return <code>0</code>.
360      */
lt(byte value)361     public static byte lt(byte value) {
362         reportMatcher(new LessThan<Byte>(value));
363         return 0;
364     }
365 
366     /**
367      * double argument less than the given value.
368      * <p>
369      * See examples in javadoc for {@link AdditionalMatchers} class
370      *
371      * @param value
372      *            the given value.
373      * @return <code>0</code>.
374      */
lt(double value)375     public static double lt(double value) {
376         reportMatcher(new LessThan<Double>(value));
377         return 0;
378     }
379 
380     /**
381      * float argument less than the given value.
382      * <p>
383      * See examples in javadoc for {@link AdditionalMatchers} class
384      *
385      * @param value
386      *            the given value.
387      * @return <code>0</code>.
388      */
lt(float value)389     public static float lt(float value) {
390         reportMatcher(new LessThan<Float>(value));
391         return 0;
392     }
393 
394     /**
395      * int argument less than the given value.
396      * <p>
397      * See examples in javadoc for {@link AdditionalMatchers} class
398      *
399      * @param value
400      *            the given value.
401      * @return <code>0</code>.
402      */
lt(int value)403     public static int lt(int value) {
404         reportMatcher(new LessThan<Integer>(value));
405         return 0;
406     }
407 
408     /**
409      * long argument less than the given value.
410      * <p>
411      * See examples in javadoc for {@link AdditionalMatchers} class
412      *
413      * @param value
414      *            the given value.
415      * @return <code>0</code>.
416      */
lt(long value)417     public static long lt(long value) {
418         reportMatcher(new LessThan<Long>(value));
419         return 0;
420     }
421 
422     /**
423      * short argument less than the given value.
424      * <p>
425      * See examples in javadoc for {@link AdditionalMatchers} class
426      *
427      * @param value
428      *            the given value.
429      * @return <code>0</code>.
430      */
lt(short value)431     public static short lt(short value) {
432         reportMatcher(new LessThan<Short>(value));
433         return 0;
434     }
435 
436     /**
437      * comparable argument equals to the given value according to their
438      * compareTo method.
439      * <p>
440      * See examples in javadoc for {@link AdditionalMatchers} class
441      *
442      * @param value
443      *            the given value.
444      * @return <code>null</code>.
445      */
cmpEq(T value)446     public static <T extends Comparable<T>> T cmpEq(T value) {
447         reportMatcher(new CompareEqual<T>(value));
448         return null;
449     }
450 
451     /**
452      * String argument that contains a substring that matches the given regular
453      * expression.
454      *
455      * @param regex
456      *            the regular expression.
457      * @return <code>null</code>.
458      */
find(String regex)459     public static String find(String regex) {
460         reportMatcher(new Find(regex));
461         return null;
462     }
463 
464     /**
465      * Object array argument that is equal to the given array, i.e. it has to
466      * have the same type, length, and each element has to be equal.
467      * <p>
468      * See examples in javadoc for {@link AdditionalMatchers} class
469      *
470      * @param <T>
471      *            the type of the array, it is passed through to prevent casts.
472      * @param value
473      *            the given array.
474      * @return <code>null</code>.
475      */
aryEq(T[] value)476     public static <T> T[] aryEq(T[] value) {
477         reportMatcher(new ArrayEquals(value));
478         return null;
479     }
480 
481     /**
482      * short array argument that is equal to the given array, i.e. it has to
483      * have the same length, and each element has to be equal.
484      * <p>
485      * See examples in javadoc for {@link AdditionalMatchers} class
486      *
487      * @param value
488      *            the given array.
489      * @return <code>null</code>.
490      */
aryEq(short[] value)491     public static short[] aryEq(short[] value) {
492         reportMatcher(new ArrayEquals(value));
493         return null;
494     }
495 
496     /**
497      * long array argument that is equal to the given array, i.e. it has to have
498      * the same length, and each element has to be equal.
499      * <p>
500      * See examples in javadoc for {@link AdditionalMatchers} class
501      *
502      * @param value
503      *            the given array.
504      * @return <code>null</code>.
505      */
aryEq(long[] value)506     public static long[] aryEq(long[] value) {
507         reportMatcher(new ArrayEquals(value));
508         return null;
509     }
510 
511     /**
512      * int array argument that is equal to the given array, i.e. it has to have
513      * the same length, and each element has to be equal.
514      * <p>
515      * See examples in javadoc for {@link AdditionalMatchers} class
516      *
517      * @param value
518      *            the given array.
519      * @return <code>null</code>.
520      */
aryEq(int[] value)521     public static int[] aryEq(int[] value) {
522         reportMatcher(new ArrayEquals(value));
523         return null;
524     }
525 
526     /**
527      * float array argument that is equal to the given array, i.e. it has to
528      * have the same length, and each element has to be equal.
529      * <p>
530      * See examples in javadoc for {@link AdditionalMatchers} class
531      *
532      * @param value
533      *            the given array.
534      * @return <code>null</code>.
535      */
aryEq(float[] value)536     public static float[] aryEq(float[] value) {
537         reportMatcher(new ArrayEquals(value));
538         return null;
539     }
540 
541     /**
542      * double array argument that is equal to the given array, i.e. it has to
543      * have the same length, and each element has to be equal.
544      * <p>
545      * See examples in javadoc for {@link AdditionalMatchers} class
546      *
547      * @param value
548      *            the given array.
549      * @return <code>null</code>.
550      */
aryEq(double[] value)551     public static double[] aryEq(double[] value) {
552         reportMatcher(new ArrayEquals(value));
553         return null;
554     }
555 
556     /**
557      * char array argument that is equal to the given array, i.e. it has to have
558      * the same length, and each element has to be equal.
559      * <p>
560      * See examples in javadoc for {@link AdditionalMatchers} class
561      *
562      * @param value
563      *            the given array.
564      * @return <code>null</code>.
565      */
aryEq(char[] value)566     public static char[] aryEq(char[] value) {
567         reportMatcher(new ArrayEquals(value));
568         return null;
569     }
570 
571     /**
572      * byte array argument that is equal to the given array, i.e. it has to have
573      * the same length, and each element has to be equal.
574      * <p>
575      * See examples in javadoc for {@link AdditionalMatchers} class
576      *
577      * @param value
578      *            the given array.
579      * @return <code>null</code>.
580      */
aryEq(byte[] value)581     public static byte[] aryEq(byte[] value) {
582         reportMatcher(new ArrayEquals(value));
583         return null;
584     }
585 
586     /**
587      * boolean array argument that is equal to the given array, i.e. it has to
588      * have the same length, and each element has to be equal.
589      * <p>
590      * See examples in javadoc for {@link AdditionalMatchers} class
591      *
592      * @param value
593      *            the given array.
594      * @return <code>null</code>.
595      */
aryEq(boolean[] value)596     public static boolean[] aryEq(boolean[] value) {
597         reportMatcher(new ArrayEquals(value));
598         return null;
599     }
600 
601     /**
602      * boolean argument that matches both given matchers.
603      * <p>
604      * See examples in javadoc for {@link AdditionalMatchers} class
605      *
606      * @param first
607      *            placeholder for the first argument matcher.
608      * @param second
609      *            placeholder for the second argument matcher.
610      * @return <code>false</code>.
611      */
and(boolean first, boolean second)612     public static boolean and(boolean first, boolean second) {
613         mockingProgress().getArgumentMatcherStorage().reportAnd();
614         return false;
615     }
616 
617     /**
618      * byte argument that matches both given argument matchers.
619      * <p>
620      * See examples in javadoc for {@link AdditionalMatchers} class
621      *
622      * @param first
623      *            placeholder for the first argument matcher.
624      * @param second
625      *            placeholder for the second argument matcher.
626      * @return <code>0</code>.
627      */
and(byte first, byte second)628     public static byte and(byte first, byte second) {
629         mockingProgress().getArgumentMatcherStorage().reportAnd();
630         return 0;
631     }
632 
633     /**
634      * char argument that matches both given argument matchers.
635      * <p>
636      * See examples in javadoc for {@link AdditionalMatchers} class
637      *
638      * @param first
639      *            placeholder for the first argument matcher.
640      * @param second
641      *            placeholder for the second argument matcher.
642      * @return <code>0</code>.
643      */
and(char first, char second)644     public static char and(char first, char second) {
645         mockingProgress().getArgumentMatcherStorage().reportAnd();
646         return 0;
647     }
648 
649     /**
650      * double argument that matches both given argument matchers.
651      * <p>
652      * See examples in javadoc for {@link AdditionalMatchers} class
653      *
654      * @param first
655      *            placeholder for the first argument matcher.
656      * @param second
657      *            placeholder for the second argument matcher.
658      * @return <code>0</code>.
659      */
and(double first, double second)660     public static double and(double first, double second) {
661         mockingProgress().getArgumentMatcherStorage().reportAnd();
662         return 0;
663     }
664 
665     /**
666      * float argument that matches both given argument matchers.
667      * <p>
668      * See examples in javadoc for {@link AdditionalMatchers} class
669      *
670      * @param first
671      *            placeholder for the first argument matcher.
672      * @param second
673      *            placeholder for the second argument matcher.
674      * @return <code>0</code>.
675      */
and(float first, float second)676     public static float and(float first, float second) {
677         mockingProgress().getArgumentMatcherStorage().reportAnd();
678         return 0;
679     }
680 
681     /**
682      * int argument that matches both given argument matchers.
683      * <p>
684      * See examples in javadoc for {@link AdditionalMatchers} class
685      *
686      * @param first
687      *            placeholder for the first argument matcher.
688      * @param second
689      *            placeholder for the second argument matcher.
690      * @return <code>0</code>.
691      */
and(int first, int second)692     public static int and(int first, int second) {
693         mockingProgress().getArgumentMatcherStorage().reportAnd();
694         return 0;
695     }
696 
697     /**
698      * long argument that matches both given argument matchers.
699      * <p>
700      * See examples in javadoc for {@link AdditionalMatchers} class
701      *
702      * @param first
703      *            placeholder for the first argument matcher.
704      * @param second
705      *            placeholder for the second argument matcher.
706      * @return <code>0</code>.
707      */
and(long first, long second)708     public static long and(long first, long second) {
709         mockingProgress().getArgumentMatcherStorage().reportAnd();
710         return 0;
711     }
712 
713     /**
714      * short argument that matches both given argument matchers.
715      * <p>
716      * See examples in javadoc for {@link AdditionalMatchers} class
717      *
718      * @param first
719      *            placeholder for the first argument matcher.
720      * @param second
721      *            placeholder for the second argument matcher.
722      * @return <code>0</code>.
723      */
and(short first, short second)724     public static short and(short first, short second) {
725         mockingProgress().getArgumentMatcherStorage().reportAnd();
726         return 0;
727     }
728 
729     /**
730      * Object argument that matches both given argument matchers.
731      * <p>
732      * See examples in javadoc for {@link AdditionalMatchers} class
733      *
734      * @param <T>
735      *            the type of the object, it is passed through to prevent casts.
736      * @param first
737      *            placeholder for the first argument matcher.
738      * @param second
739      *            placeholder for the second argument matcher.
740      * @return <code>null</code>.
741      */
and(T first, T second)742     public static <T> T and(T first, T second) {
743         mockingProgress().getArgumentMatcherStorage().reportAnd();
744         return null;
745     }
746 
747     /**
748      * boolean argument that matches any of the given argument matchers.
749      * <p>
750      * See examples in javadoc for {@link AdditionalMatchers} class
751      *
752      * @param first
753      *            placeholder for the first argument matcher.
754      * @param second
755      *            placeholder for the second argument matcher.
756      * @return <code>false</code>.
757      */
or(boolean first, boolean second)758     public static boolean or(boolean first, boolean second) {
759         mockingProgress().getArgumentMatcherStorage().reportOr();
760         return false;
761     }
762 
763     /**
764      * Object argument that matches any of the given argument matchers.
765      * <p>
766      * See examples in javadoc for {@link AdditionalMatchers} class
767      *
768      * @param <T>
769      *            the type of the object, it is passed through to prevent casts.
770      * @param first
771      *            placeholder for the first argument matcher.
772      * @param second
773      *            placeholder for the second argument matcher.
774      * @return <code>null</code>.
775      */
or(T first, T second)776     public static <T> T or(T first, T second) {
777         mockingProgress().getArgumentMatcherStorage().reportOr();
778         return null;
779     }
780 
781     /**
782      * short argument that matches any of the given argument matchers.
783      * <p>
784      * See examples in javadoc for {@link AdditionalMatchers} class
785      *
786      * @param first
787      *            placeholder for the first argument matcher.
788      * @param second
789      *            placeholder for the second argument matcher.
790      * @return <code>0</code>.
791      */
or(short first, short second)792     public static short or(short first, short second) {
793         mockingProgress().getArgumentMatcherStorage().reportOr();
794         return 0;
795     }
796 
797     /**
798      * long argument that matches any of the given argument matchers.
799      * <p>
800      * See examples in javadoc for {@link AdditionalMatchers} class
801      *
802      * @param first
803      *            placeholder for the first argument matcher.
804      * @param second
805      *            placeholder for the second argument matcher.
806      * @return <code>0</code>.
807      */
or(long first, long second)808     public static long or(long first, long second) {
809         mockingProgress().getArgumentMatcherStorage().reportOr();
810         return 0;
811     }
812 
813     /**
814      * int argument that matches any of the given argument matchers.
815      * <p>
816      * See examples in javadoc for {@link AdditionalMatchers} class
817      *
818      * @param first
819      *            placeholder for the first argument matcher.
820      * @param second
821      *            placeholder for the second argument matcher.
822      * @return <code>0</code>.
823      */
or(int first, int second)824     public static int or(int first, int second) {
825         mockingProgress().getArgumentMatcherStorage().reportOr();
826         return 0;
827     }
828 
829     /**
830      * float argument that matches any of the given argument matchers.
831      * <p>
832      * See examples in javadoc for {@link AdditionalMatchers} class
833      *
834      * @param first
835      *            placeholder for the first argument matcher.
836      * @param second
837      *            placeholder for the second argument matcher.
838      * @return <code>0</code>.
839      */
or(float first, float second)840     public static float or(float first, float second) {
841         mockingProgress().getArgumentMatcherStorage().reportOr();
842         return 0;
843     }
844 
845     /**
846      * double argument that matches any of the given argument matchers.
847      * <p>
848      * See examples in javadoc for {@link AdditionalMatchers} class
849      *
850      * @param first
851      *            placeholder for the first argument matcher.
852      * @param second
853      *            placeholder for the second argument matcher.
854      * @return <code>0</code>.
855      */
or(double first, double second)856     public static double or(double first, double second) {
857         mockingProgress().getArgumentMatcherStorage().reportOr();
858         return 0;
859     }
860 
861     /**
862      * char argument that matches any of the given argument matchers.
863      * <p>
864      * See examples in javadoc for {@link AdditionalMatchers} class
865      *
866      * @param first
867      *            placeholder for the first argument matcher.
868      * @param second
869      *            placeholder for the second argument matcher.
870      * @return <code>0</code>.
871      */
or(char first, char second)872     public static char or(char first, char second) {
873         mockingProgress().getArgumentMatcherStorage().reportOr();
874         return 0;
875     }
876 
877     /**
878      * byte argument that matches any of the given argument matchers.
879      * <p>
880      * See examples in javadoc for {@link AdditionalMatchers} class
881      *
882      * @param first
883      *            placeholder for the first argument matcher.
884      * @param second
885      *            placeholder for the second argument matcher.
886      * @return <code>0</code>.
887      */
or(byte first, byte second)888     public static byte or(byte first, byte second) {
889         mockingProgress().getArgumentMatcherStorage().reportOr();
890         return 0;
891     }
892 
893     /**
894      * Object argument that does not match the given argument matcher.
895      * <p>
896      * See examples in javadoc for {@link AdditionalMatchers} class
897      *
898      * @param <T>
899      *            the type of the object, it is passed through to prevent casts.
900      * @param first
901      *            placeholder for the argument matcher.
902      * @return <code>null</code>.
903      */
not(T first)904     public static <T> T not(T first) {
905         mockingProgress().getArgumentMatcherStorage().reportNot();
906         return null;
907     }
908 
909     /**
910      * short argument that does not match the given argument matcher.
911      * <p>
912      * See examples in javadoc for {@link AdditionalMatchers} class
913      *
914      * @param first
915      *            placeholder for the argument matcher.
916      * @return <code>0</code>.
917      */
not(short first)918     public static short not(short first) {
919         mockingProgress().getArgumentMatcherStorage().reportNot();
920         return 0;
921     }
922 
923     /**
924      * int argument that does not match the given argument matcher.
925      * <p>
926      * See examples in javadoc for {@link AdditionalMatchers} class
927      *
928      * @param first
929      *            placeholder for the argument matcher.
930      * @return <code>0</code>.
931      */
not(int first)932     public static int not(int first) {
933         mockingProgress().getArgumentMatcherStorage().reportNot();
934         return 0;
935     }
936 
937     /**
938      * long argument that does not match the given argument matcher.
939      * <p>
940      * See examples in javadoc for {@link AdditionalMatchers} class
941      *
942      * @param first
943      *            placeholder for the argument matcher.
944      * @return <code>0</code>.
945      */
not(long first)946     public static long not(long first) {
947         mockingProgress().getArgumentMatcherStorage().reportNot();
948         return 0;
949     }
950 
951     /**
952      * float argument that does not match the given argument matcher.
953      * <p>
954      * See examples in javadoc for {@link AdditionalMatchers} class
955      *
956      * @param first
957      *            placeholder for the argument matcher.
958      * @return <code>0</code>.
959      */
not(float first)960     public static float not(float first) {
961         mockingProgress().getArgumentMatcherStorage().reportNot();
962         return 0;
963     }
964 
965     /**
966      * double argument that does not match the given argument matcher.
967      * <p>
968      * See examples in javadoc for {@link AdditionalMatchers} class
969      *
970      * @param first
971      *            placeholder for the argument matcher.
972      * @return <code>0</code>.
973      */
not(double first)974     public static double not(double first) {
975         mockingProgress().getArgumentMatcherStorage().reportNot();
976         return 0;
977     }
978 
979     /**
980      * char argument that does not match the given argument matcher.
981      * <p>
982      * See examples in javadoc for {@link AdditionalMatchers} class
983      *
984      * @param first
985      *            placeholder for the argument matcher.
986      * @return <code>0</code>.
987      */
not(char first)988     public static char not(char first) {
989         mockingProgress().getArgumentMatcherStorage().reportNot();
990         return 0;
991     }
992 
993     /**
994      * boolean argument that does not match the given argument matcher.
995      * <p>
996      * See examples in javadoc for {@link AdditionalMatchers} class
997      *
998      * @param first
999      *            placeholder for the argument matcher.
1000      * @return <code>false</code>.
1001      */
not(boolean first)1002     public static boolean not(boolean first) {
1003         mockingProgress().getArgumentMatcherStorage().reportNot();
1004         return false;
1005     }
1006 
1007     /**
1008      * byte argument that does not match the given argument matcher.
1009      * <p>
1010      * See examples in javadoc for {@link AdditionalMatchers} class
1011      *
1012      * @param first
1013      *            placeholder for the argument matcher.
1014      * @return <code>0</code>.
1015      */
not(byte first)1016     public static byte not(byte first) {
1017         mockingProgress().getArgumentMatcherStorage().reportNot();
1018         return 0;
1019     }
1020 
1021     /**
1022      * double argument that has an absolute difference to the given value that
1023      * is less than the given delta details.
1024      * <p>
1025      * See examples in javadoc for {@link AdditionalMatchers} class
1026      *
1027      * @param value
1028      *            the given value.
1029      * @param delta
1030      *            the given delta.
1031      * @return <code>0</code>.
1032      */
eq(double value, double delta)1033     public static double eq(double value, double delta) {
1034         reportMatcher(new EqualsWithDelta(value, delta));
1035         return 0;
1036     }
1037 
1038     /**
1039      * float argument that has an absolute difference to the given value that is
1040      * less than the given delta details.
1041      * <p>
1042      * See examples in javadoc for {@link AdditionalMatchers} class
1043      *
1044      * @param value
1045      *            the given value.
1046      * @param delta
1047      *            the given delta.
1048      * @return <code>0</code>.
1049      */
eq(float value, float delta)1050     public static float eq(float value, float delta) {
1051         reportMatcher(new EqualsWithDelta(value, delta));
1052         return 0;
1053     }
1054 
reportMatcher(ArgumentMatcher<?> matcher)1055     private static void reportMatcher(ArgumentMatcher<?> matcher) {
1056         mockingProgress().getArgumentMatcherStorage().reportMatcher(matcher);
1057     }
1058 }
1059