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