KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > easymock > MockControl


1 /*
2  * Copyright (c) 2001-2005 OFFIS. This program is made available under the terms of
3  * the MIT License.
4  */

5 package org.easymock;
6
7 import java.lang.reflect.InvocationHandler JavaDoc;
8 import java.lang.reflect.Method JavaDoc;
9
10 import junit.framework.AssertionFailedError;
11
12 import org.easymock.internal.AlwaysMatcher;
13 import org.easymock.internal.ArrayMatcher;
14 import org.easymock.internal.AssertionFailedErrorWrapper;
15 import org.easymock.internal.EqualsMatcher;
16 import org.easymock.internal.IBehavior;
17 import org.easymock.internal.IBehaviorFactory;
18 import org.easymock.internal.IMockControlState;
19 import org.easymock.internal.IProxyFactory;
20 import org.easymock.internal.JavaProxyFactory;
21 import org.easymock.internal.NiceBehavior;
22 import org.easymock.internal.ObjectMethodsFilter;
23 import org.easymock.internal.OrderedBehavior;
24 import org.easymock.internal.Range;
25 import org.easymock.internal.RecordState;
26 import org.easymock.internal.ReplayState;
27 import org.easymock.internal.RuntimeExceptionWrapper;
28 import org.easymock.internal.ThrowableWrapper;
29 import org.easymock.internal.UnorderedBehavior;
30
31 /**
32  * A <code>MockControl</code> object controls the behavior of its associated
33  * mock object. For more information, see the EasyMock documentation.
34  */

35 public class MockControl<T> {
36     private IMockControlState state;
37
38     private T mock;
39
40     private IBehavior behavior;
41
42     private IBehaviorFactory behaviorFactory;
43
44     /**
45      * internal constant with <code>protected</code> visibility to allow
46      * access for extensions.
47      */

48     protected static final IBehaviorFactory NICE_BEHAVIOR_FACTORY = new IBehaviorFactory() {
49         public IBehavior createBehavior() {
50             return new NiceBehavior();
51         }
52     };
53
54     /**
55      * internal constant with <code>protected</code> visibility to allow
56      * access for extensions.
57      */

58     protected static final IBehaviorFactory ORDERED_BEHAVIOR_FACTORY = new IBehaviorFactory() {
59         public IBehavior createBehavior() {
60             return new OrderedBehavior();
61         }
62     };
63
64     /**
65      * internal constant with <code>protected</code> visibility to allow
66      * access for extensions.
67      */

68     protected static final IBehaviorFactory UNORDERED_BEHAVIOR_FACTORY = new IBehaviorFactory() {
69         public IBehavior createBehavior() {
70             return new UnorderedBehavior();
71         }
72     };
73
74     /**
75      * Creates a mock control object for the specified interface. The
76      * <code>MockControl</code> and its associated mock object will not check
77      * the order of expected method calls. An unexpected method call on the mock
78      * object will lead to an <code>AssertionFailedError</code>.
79      *
80      * @param toMock
81      * the class of the interface to mock.
82      * @return the mock control.
83      */

84     public static <T> MockControl<T> createControl(Class JavaDoc<T> toMock) {
85         return new MockControl<T>(toMock, new JavaProxyFactory<T>(),
86                 UNORDERED_BEHAVIOR_FACTORY);
87     }
88
89     /**
90      * Creates a mock control object for the specified interface. The
91      * <code>MockControl</code> and its associated mock object will check the
92      * order of expected method calls. An unexpected method call on the mock
93      * object will lead to an <code>AssertionFailedError</code>.
94      *
95      * @param toMock
96      * the class of the interface to mock.
97      * @return the mock control.
98      */

99     public static <T> MockControl<T> createStrictControl(Class JavaDoc<T> toMock) {
100         return new MockControl<T>(toMock, new JavaProxyFactory<T>(),
101                 ORDERED_BEHAVIOR_FACTORY);
102     }
103
104     /**
105      * Creates a mock control object for the specified interface. The
106      * <code>MockControl</code> and its associated mock object will not check
107      * the order of expected method calls. An unexpected method call on the mock
108      * object will return an empty value (0, null, false).
109      *
110      * @param toMock
111      * the class of the interface to mock.
112      * @return the mock control.
113      */

114     public static <T> MockControl<T> createNiceControl(Class JavaDoc<T> toMock) {
115         return new MockControl<T>(toMock, new JavaProxyFactory<T>(),
116                 NICE_BEHAVIOR_FACTORY);
117     }
118
119     /**
120      * Creates a new mock control object using the provided proxy and behavior
121      * factory - this is an internal constructor with <code>protected</code>
122      * visibility to allow access for extensions.
123      *
124      * @param toMock
125      * the class of the interface to mock.
126      * @param proxyFactory
127      * the proxy factory.
128      * @param behaviorFactory
129      * the behavior factory.
130      */

131     protected MockControl(Class JavaDoc<T> toMock, IProxyFactory<T> proxyFactory,
132             IBehaviorFactory behaviorFactory) {
133         mock = proxyFactory.createProxy(toMock, new ObjectMethodsFilter(
134                 createDelegator()));
135         this.behaviorFactory = behaviorFactory;
136         reset();
137     }
138
139     private InvocationHandler JavaDoc createDelegator() {
140         return new InvocationHandler JavaDoc() {
141             public Object JavaDoc invoke(Object JavaDoc proxy, Method JavaDoc method, Object JavaDoc[] args)
142                     throws Throwable JavaDoc {
143                 try {
144                     return state.invoke(proxy, method, args);
145                 } catch (RuntimeExceptionWrapper e) {
146                     throw e.getRuntimeException().fillInStackTrace();
147                 } catch (AssertionFailedErrorWrapper e) {
148                     throw e.getAssertionFailedError().fillInStackTrace();
149                 } catch (ThrowableWrapper t) {
150                     throw t.getThrowable().fillInStackTrace();
151                 }
152             }
153         };
154     }
155
156     /**
157      * Returns the mock object.
158      *
159      * @return the mock object of this control
160      */

161     public T getMock() {
162         return mock;
163     }
164
165     /**
166      * Resets the mock control and the mock object to the state directly after
167      * creation.
168      */

169     public final void reset() {
170         behavior = behaviorFactory.createBehavior();
171         state = new RecordState(behavior);
172     }
173
174     /**
175      * Switches the mock object from record state to replay state. For more
176      * information, see the EasyMock documentation.
177      *
178      * @throws IllegalStateException
179      * if the mock object already is in replay state.
180      */

181     public void replay() {
182         try {
183             state.replay();
184             state = new ReplayState(behavior);
185         } catch (RuntimeExceptionWrapper e) {
186             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
187         }
188     }
189
190     /**
191      * Verifies that all expectations have been met. For more information, see
192      * the EasyMock documentation.
193      *
194      * @throws IllegalStateException
195      * if the mock object is in record state.
196      * @throws AssertionFailedError
197      * if any expectation has not been met.
198      */

199     public void verify() {
200         try {
201             state.verify();
202         } catch (RuntimeExceptionWrapper e) {
203             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
204         } catch (AssertionFailedErrorWrapper e) {
205             throw (AssertionFailedError) e.getAssertionFailedError()
206                     .fillInStackTrace();
207         }
208     }
209
210     /**
211      * Records that the mock object will expect the last method call once, and
212      * will react by returning silently.
213      *
214      * @exception IllegalStateException
215      * if the mock object is in replay state, if no method was
216      * called on the mock object before, or if the last method
217      * called on the mock was no void method.
218      */

219     public void setVoidCallable() {
220         try {
221             state.setVoidCallable(MockControl.ONE);
222         } catch (RuntimeExceptionWrapper e) {
223             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
224         }
225     }
226
227     /**
228      * Records that the mock object will expect the last method call once, and
229      * will react by throwing the provided Throwable.
230      *
231      * @param throwable
232      * the Throwable to throw.
233      * @exception IllegalStateException
234      * if the mock object is in replay state or if no method was
235      * called on the mock object before.
236      * @exception IllegalArgumentException
237      * if the last method called on the mock cannot throw the
238      * provided Throwable.
239      * @exception NullPointerException
240      * if throwable is null.
241      */

242     public void setThrowable(Throwable JavaDoc throwable) {
243         try {
244             state.setThrowable(throwable, MockControl.ONE);
245         } catch (RuntimeExceptionWrapper e) {
246             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
247         }
248     }
249
250     /**
251      * Records that the mock object will expect the last method call once, and
252      * will react by returning the provided return value.
253      *
254      * @param value
255      * the return value.
256      * @throws IllegalStateException
257      * if the mock object is in replay state, if no method was
258      * called on the mock object before. or if the last method
259      * called on the mock does not return <code>boolean</code>.
260      */

261     public void setReturnValue(boolean value) {
262         try {
263             state.setReturnValue(value, MockControl.ONE);
264         } catch (RuntimeExceptionWrapper e) {
265             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
266         }
267     }
268
269     /**
270      * Records that the mock object will expect the last method call once, and
271      * will react by returning the provided return value.
272      *
273      * @param value
274      * the return value.
275      * @throws IllegalStateException
276      * if the mock object is in replay state, if no method was
277      * called on the mock object before. or if the last method
278      * called on the mock does not return
279      * <code>byte, short, char, int, or long</code>.
280      */

281     public void setReturnValue(long value) {
282         try {
283             state.setReturnValue(value, MockControl.ONE);
284         } catch (RuntimeExceptionWrapper e) {
285             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
286         }
287     }
288
289     /**
290      * Records that the mock object will expect the last method call once, and
291      * will react by returning the provided return value.
292      *
293      * @param value
294      * the return value.
295      * @throws IllegalStateException
296      * if the mock object is in replay state, if no method was
297      * called on the mock object before. or if the last method
298      * called on the mock does not return <code>float</code>.
299      */

300     public void setReturnValue(float value) {
301         try {
302             state.setReturnValue(value, MockControl.ONE);
303         } catch (RuntimeExceptionWrapper e) {
304             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
305         }
306     }
307
308     /**
309      * Records that the mock object will expect the last method call once, and
310      * will react by returning the provided return value.
311      *
312      * @param value
313      * the return value.
314      * @throws IllegalStateException
315      * if the mock object is in replay state, if no method was
316      * called on the mock object before. or if the last method
317      * called on the mock does not return <code>double</code>.
318      */

319     public void setReturnValue(double value) {
320         try {
321             state.setReturnValue(value, MockControl.ONE);
322         } catch (RuntimeExceptionWrapper e) {
323             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
324         }
325     }
326
327     /**
328      * Records that the mock object will expect the last method call once, and
329      * will react by returning the provided return value.
330      *
331      * @param value
332      * the return value.
333      * @throws IllegalStateException
334      * if the mock object is in replay state, if no method was
335      * called on the mock object before. or if the last method
336      * called on the mock does not return an object.
337      * @throws IllegalArgumentException
338      * if the provided return value is not compatible to the return
339      * value of the last method called on the mock object.
340      */

341     public void setReturnValue(Object JavaDoc value) {
342         try {
343             state.setReturnValue(value, MockControl.ONE);
344         } catch (RuntimeExceptionWrapper e) {
345             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
346         }
347     }
348
349     /**
350      * Records that the mock object will expect the last method call a fixed
351      * number of times, and will react by returning silently.
352      *
353      * @param times
354      * the number of times that the call is expected.
355      * @exception IllegalStateException
356      * if the mock object is in replay state, if no method was
357      * called on the mock object before, or if the last method
358      * called on the mock was no void method.
359      */

360     public void setVoidCallable(int times) {
361         try {
362             state.setVoidCallable(new Range(times));
363         } catch (RuntimeExceptionWrapper e) {
364             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
365         }
366     }
367
368     /**
369      * Records that the mock object will expect the last method call a fixed
370      * number of times, and will react by throwing the provided Throwable.
371      *
372      * @param throwable
373      * the Throwable to throw.
374      * @param times
375      * the number of times that the call is expected.
376      * @exception IllegalStateException
377      * if the mock object is in replay state or if no method was
378      * called on the mock object before.
379      * @exception IllegalArgumentException
380      * if the last method called on the mock cannot throw the
381      * provided Throwable.
382      * @exception NullPointerException
383      * if throwable is null.
384      */

385     public void setThrowable(Throwable JavaDoc throwable, int times) {
386         try {
387             state.setThrowable(throwable, new Range(times));
388         } catch (RuntimeExceptionWrapper e) {
389             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
390         }
391     }
392
393     /**
394      * Records that the mock object will expect the last method call a fixed
395      * number of times, and will react by returning the provided return value.
396      *
397      * @param value
398      * the return value.
399      * @param times
400      * the number of times that the call is expected.
401      * @throws IllegalStateException
402      * if the mock object is in replay state, if no method was
403      * called on the mock object before. or if the last method
404      * called on the mock does not return <code>boolean</code>.
405      */

406     public void setReturnValue(boolean value, int times) {
407         try {
408             state.setReturnValue(value, new Range(times));
409         } catch (RuntimeExceptionWrapper e) {
410             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
411         }
412     }
413
414     /**
415      * Records that the mock object will expect the last method call a fixed
416      * number of times, and will react by returning the provided return value.
417      *
418      * @param value
419      * the return value.
420      * @param times
421      * the number of times that the call is expected.
422      * @throws IllegalStateException
423      * if the mock object is in replay state, if no method was
424      * called on the mock object before. or if the last method
425      * called on the mock does not return <code>double</code>.
426      */

427     public void setReturnValue(double value, int times) {
428         try {
429             state.setReturnValue(value, new Range(times));
430         } catch (RuntimeExceptionWrapper e) {
431             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
432         }
433     }
434
435     /**
436      * Records that the mock object will expect the last method call a fixed
437      * number of times, and will react by returning the provided return value.
438      *
439      * @param value
440      * the return value.
441      * @param times
442      * the number of times that the call is expected.
443      * @throws IllegalStateException
444      * if the mock object is in replay state, if no method was
445      * called on the mock object before. or if the last method
446      * called on the mock does not return <code>float</code>.
447      */

448     public void setReturnValue(float value, int times) {
449         try {
450             state.setReturnValue(value, new Range(times));
451         } catch (RuntimeExceptionWrapper e) {
452             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
453         }
454     }
455
456     /**
457      * Records that the mock object will expect the last method call a fixed
458      * number of times, and will react by returning the provided return value.
459      *
460      * @param value
461      * the return value.
462      * @param times
463      * the number of times that the call is expected.
464      * @throws IllegalStateException
465      * if the mock object is in replay state, if no method was
466      * called on the mock object before. or if the last method
467      * called on the mock does not return
468      * <code>byte, short, char, int, or long</code>.
469      */

470     public void setReturnValue(long value, int times) {
471         try {
472             state.setReturnValue(value, new Range(times));
473         } catch (RuntimeExceptionWrapper e) {
474             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
475         }
476     }
477
478     /**
479      * Records that the mock object will expect the last method call a fixed
480      * number of times, and will react by returning the provided return value.
481      *
482      * @param value
483      * the return value.
484      * @param times
485      * the number of times that the call is expected.
486      * @throws IllegalStateException
487      * if the mock object is in replay state, if no method was
488      * called on the mock object before. or if the last method
489      * called on the mock does not return an object.
490      * @throws IllegalArgumentException
491      * if the provided return value is not compatible to the return
492      * value of the last method called on the mock object.
493      */

494     public void setReturnValue(Object JavaDoc value, int times) {
495         try {
496             state.setReturnValue(value, new Range(times));
497         } catch (RuntimeExceptionWrapper e) {
498             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
499         }
500     }
501
502     /**
503      * Records that the mock object will expect the last method call the number
504      * of times specified by the range argument, and will react by returning
505      * silently. Available range arguments are:
506      * <ul>
507      * <li>{@link MockControl#ZERO_OR_MORE}</li>
508      * <li>{@link MockControl#ONE}</li>
509      * <li>{@link MockControl#ONE_OR_MORE}</li>
510      * </ul>
511      *
512      * @param range
513      * the number of times that the call is expected.
514      * @exception IllegalStateException
515      * if the mock object is in replay state, if no method was
516      * called on the mock object before, or if the last method
517      * called on the mock was no void method.
518      */

519     public void setVoidCallable(Range range) {
520         try {
521             state.setVoidCallable(range);
522         } catch (RuntimeExceptionWrapper e) {
523             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
524         }
525     }
526
527     /**
528      * Records that the mock object will expect the last method call the number
529      * of times specified by the range argument, and will react by throwing the
530      * provided Throwable. Available range arguments are:
531      * <ul>
532      * <li>{@link MockControl#ZERO_OR_MORE}</li>
533      * <li>{@link MockControl#ONE}</li>
534      * <li>{@link MockControl#ONE_OR_MORE}</li>
535      * </ul>
536      *
537      * @param throwable
538      * the Throwable to throw.
539      * @param range
540      * the number of times that the call is expected.
541      * @exception IllegalStateException
542      * if the mock object is in replay state or if no method was
543      * called on the mock object before.
544      * @exception IllegalArgumentException
545      * if the last method called on the mock cannot throw the
546      * provided Throwable.
547      * @exception NullPointerException
548      * if throwable is null.
549      */

550     public void setThrowable(Throwable JavaDoc throwable, Range range) {
551         try {
552             state.setThrowable(throwable, range);
553         } catch (RuntimeExceptionWrapper e) {
554             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
555         }
556     }
557
558     /**
559      * Records that the mock object will expect the last method call the number
560      * of times specified by the range argument, and will react by returning the
561      * provided return value. Available range arguments are:
562      * <ul>
563      * <li>{@link MockControl#ZERO_OR_MORE}</li>
564      * <li>{@link MockControl#ONE}</li>
565      * <li>{@link MockControl#ONE_OR_MORE}</li>
566      * </ul>
567      *
568      * @param value
569      * the return value.
570      * @param range
571      * the number of times that the call is expected.
572      * @throws IllegalStateException
573      * if the mock object is in replay state, if no method was
574      * called on the mock object before. or if the last method
575      * called on the mock does not return <code>boolean</code>.
576      */

577     public void setReturnValue(boolean value, Range range) {
578         try {
579             state.setReturnValue(value, range);
580         } catch (RuntimeExceptionWrapper e) {
581             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
582         }
583     }
584
585     /**
586      * Records that the mock object will expect the last method call the number
587      * of times specified by the range argument, and will react by returning the
588      * provided return value. Available range arguments are:
589      * <ul>
590      * <li>{@link MockControl#ZERO_OR_MORE}</li>
591      * <li>{@link MockControl#ONE}</li>
592      * <li>{@link MockControl#ONE_OR_MORE}</li>
593      * </ul>
594      *
595      * @param value
596      * the return value.
597      * @param range
598      * the number of times that the call is expected.
599      * @throws IllegalStateException
600      * if the mock object is in replay state, if no method was
601      * called on the mock object before. or if the last method
602      * called on the mock does not return <code>double</code>.
603      */

604     public void setReturnValue(double value, Range range) {
605         try {
606             state.setReturnValue(value, range);
607         } catch (RuntimeExceptionWrapper e) {
608             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
609         }
610     }
611
612     /**
613      * Records that the mock object will expect the last method call the number
614      * of times specified by the range argument, and will react by returning the
615      * provided return value. Available range arguments are:
616      * <ul>
617      * <li>{@link MockControl#ZERO_OR_MORE}</li>
618      * <li>{@link MockControl#ONE}</li>
619      * <li>{@link MockControl#ONE_OR_MORE}</li>
620      * </ul>
621      *
622      * @param value
623      * the return value.
624      * @param range
625      * the number of times that the call is expected.
626      * @throws IllegalStateException
627      * if the mock object is in replay state, if no method was
628      * called on the mock object before. or if the last method
629      * called on the mock does not return <code>float</code>.
630      */

631     public void setReturnValue(float value, Range range) {
632         try {
633             state.setReturnValue(value, range);
634         } catch (RuntimeExceptionWrapper e) {
635             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
636         }
637     }
638
639     /**
640      * Records that the mock object will expect the last method call the number
641      * of times specified by the range argument, and will react by returning the
642      * provided return value. Available range arguments are:
643      * <ul>
644      * <li>{@link MockControl#ZERO_OR_MORE}</li>
645      * <li>{@link MockControl#ONE}</li>
646      * <li>{@link MockControl#ONE_OR_MORE}</li>
647      * </ul>
648      *
649      * @param value
650      * the return value.
651      * @param range
652      * the number of times that the call is expected.
653      * @throws IllegalStateException
654      * if the mock object is in replay state, if no method was
655      * called on the mock object before. or if the last method
656      * called on the mock does not return
657      * <code>byte, short, char, int, or long</code>.
658      */

659     public void setReturnValue(long value, Range range) {
660         try {
661             state.setReturnValue(value, range);
662         } catch (RuntimeExceptionWrapper e) {
663             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
664         }
665     }
666
667     /**
668      * Records that the mock object will expect the last method call the number
669      * of times specified by the range argument, and will react by returning the
670      * provided return value. Available range arguments are:
671      * <ul>
672      * <li>{@link MockControl#ZERO_OR_MORE}</li>
673      * <li>{@link MockControl#ONE}</li>
674      * <li>{@link MockControl#ONE_OR_MORE}</li>
675      * </ul>
676      *
677      * @param value
678      * the return value.
679      * @param range
680      * the number of times that the call is expected.
681      * @throws IllegalStateException
682      * if the mock object is in replay state, if no method was
683      * called on the mock object before. or if the last method
684      * called on the mock does not return an object.
685      * @throws IllegalArgumentException
686      * if the provided return value is not compatible to the return
687      * value of the last method called on the mock object.
688      */

689     public void setReturnValue(Object JavaDoc value, Range range) {
690         try {
691             state.setReturnValue(value, range);
692         } catch (RuntimeExceptionWrapper e) {
693             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
694         }
695     }
696
697     /**
698      * Records that the mock object will by default allow the last method
699      * specified by a method call.
700      *
701      * @exception IllegalStateException
702      * if the mock object is in replay state, if no method was
703      * called on the mock object before, or if the last method
704      * called on the mock was no void method.
705      */

706     public void setDefaultVoidCallable() {
707         try {
708             state.setDefaultVoidCallable();
709         } catch (RuntimeExceptionWrapper e) {
710             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
711         }
712     }
713
714     /**
715      * Records that the mock object will by default allow the last method
716      * specified by a method call, and will react by throwing the provided
717      * Throwable.
718      *
719      * @param throwable
720      * throwable the throwable to be thrown
721      * @exception IllegalArgumentException
722      * if the last method called on the mock cannot throw the
723      * provided Throwable.
724      * @exception NullPointerException
725      * if throwable is null.
726      * @exception IllegalStateException
727      * if the mock object is in replay state, or if no method was
728      * called on the mock object before.
729      */

730     public void setDefaultThrowable(Throwable JavaDoc throwable) {
731         try {
732             state.setDefaultThrowable(throwable);
733         } catch (RuntimeExceptionWrapper e) {
734             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
735         }
736     }
737
738     /**
739      * Records that the mock object will by default allow the last method
740      * specified by a method call, and will react by returning the provided
741      * return value.
742      *
743      * @param value
744      * the return value.
745      * @throws IllegalStateException
746      * if the mock object is in replay state, if no method was
747      * called on the mock object before. or if the last method
748      * called on the mock does not return <code>boolean</code>.
749      */

750     public void setDefaultReturnValue(boolean value) {
751         try {
752             state.setDefaultReturnValue(value);
753         } catch (RuntimeExceptionWrapper e) {
754             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
755         }
756     }
757
758     /**
759      * Records that the mock object will by default allow the last method
760      * specified by a method call, and will react by returning the provided
761      * return value.
762      *
763      * @param value
764      * the return value.
765      * @throws IllegalStateException
766      * if the mock object is in replay state, if no method was
767      * called on the mock object before. or if the last method
768      * called on the mock does not return
769      * <code>byte, short, char, int, or long</code>.
770      */

771     public void setDefaultReturnValue(long value) {
772         try {
773             state.setDefaultReturnValue(value);
774         } catch (RuntimeExceptionWrapper e) {
775             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
776         }
777     }
778
779     /**
780      * Records that the mock object will by default allow the last method
781      * specified by a method call, and will react by returning the provided
782      * return value.
783      *
784      * @param value
785      * the return value.
786      * @throws IllegalStateException
787      * if the mock object is in replay state, if no method was
788      * called on the mock object before. or if the last method
789      * called on the mock does not return <code>float</code>.
790      */

791     public void setDefaultReturnValue(float value) {
792         try {
793             state.setDefaultReturnValue(value);
794         } catch (RuntimeExceptionWrapper e) {
795             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
796         }
797     }
798
799     /**
800      * Records that the mock object will by default allow the last method
801      * specified by a method call, and will react by returning the provided
802      * return value.
803      *
804      * @param value
805      * the return value.
806      * @throws IllegalStateException
807      * if the mock object is in replay state, if no method was
808      * called on the mock object before. or if the last method
809      * called on the mock does not return <code>double</code>.
810      */

811     public void setDefaultReturnValue(double value) {
812         try {
813             state.setDefaultReturnValue(value);
814         } catch (RuntimeExceptionWrapper e) {
815             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
816         }
817     }
818
819     /**
820      * Records that the mock object will by default allow the last method
821      * specified by a method call, and will react by returning the provided
822      * return value.
823      *
824      * @param value
825      * the return value.
826      * @throws IllegalStateException
827      * if the mock object is in replay state, if no method was
828      * called on the mock object before. or if the last method
829      * called on the mock does not return an object.
830      * @throws IllegalArgumentException
831      * if the provided return value is not compatible to the return
832      * value of the last method called on the mock object.
833      */

834     public void setDefaultReturnValue(Object JavaDoc value) {
835         try {
836             state.setDefaultReturnValue(value);
837         } catch (RuntimeExceptionWrapper e) {
838             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
839         }
840     }
841
842     /**
843      * Sets the ArgumentsMatcher for the last method called on the mock object.
844      * The matcher must be set before any behavior for the method is defined.
845      *
846      * @throws IllegalStateException
847      * if called in replay state, or if no method was called on the
848      * mock object before.
849      */

850     public void setMatcher(ArgumentsMatcher matcher) {
851         try {
852             state.setMatcher(matcher);
853         } catch (RuntimeExceptionWrapper e) {
854             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
855         }
856     }
857
858     /**
859      * Records that the mock object will expect the last method call between
860      * <code>minCount</code> and <code>maxCount</code> times, and will react
861      * by returning silently.
862      *
863      * @param minCount
864      * the minimum number of times that the call is expected.
865      * @param maxCount
866      * the maximum number of times that the call is expected.
867      * @exception IllegalStateException
868      * if the mock object is in replay state, if no method was
869      * called on the mock object before, or if the last method
870      * called on the mock was no void method.
871      */

872     public void setVoidCallable(int minCount, int maxCount) {
873         try {
874             state.setVoidCallable(new Range(minCount, maxCount));
875         } catch (RuntimeExceptionWrapper e) {
876             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
877         }
878     }
879
880     /**
881      * Records that the mock object will expect the last method call between
882      * <code>minCount</code> and <code>maxCount</code> times, and will react
883      * by throwing the provided Throwable.
884      *
885      * @param throwable
886      * the Throwable to throw.
887      * @param minCount
888      * the minimum number of times that the call is expected.
889      * @param maxCount
890      * the maximum number of times that the call is expected.
891      * @exception IllegalStateException
892      * if the mock object is in replay state or if no method was
893      * called on the mock object before.
894      * @exception IllegalArgumentException
895      * if the last method called on the mock cannot throw the
896      * provided Throwable.
897      * @exception NullPointerException
898      * if throwable is null.
899      */

900     public void setThrowable(Throwable JavaDoc throwable, int minCount, int maxCount) {
901         try {
902             state.setThrowable(throwable, new Range(minCount, maxCount));
903         } catch (RuntimeExceptionWrapper e) {
904             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
905         }
906     }
907
908     /**
909      * Records that the mock object will expect the last method call between
910      * <code>minCount</code> and <code>maxCount</code> times, and will react
911      * by returning the provided return value.
912      *
913      * @param value
914      * the return value.
915      * @param minCount
916      * the minimum number of times that the call is expected.
917      * @param maxCount
918      * the maximum number of times that the call is expected.
919      * @throws IllegalStateException
920      * if the mock object is in replay state, if no method was
921      * called on the mock object before. or if the last method
922      * called on the mock does not return <code>boolean</code>.
923      */

924     public void setReturnValue(boolean value, int minCount, int maxCount) {
925         try {
926             state.setReturnValue(value, new Range(minCount, maxCount));
927         } catch (RuntimeExceptionWrapper e) {
928             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
929         }
930     }
931
932     /**
933      * Records that the mock object will expect the last method call between
934      * <code>minCount</code> and <code>maxCount</code> times, and will react
935      * by returning the provided return value.
936      *
937      * @param value
938      * the return value.
939      * @param minCount
940      * the minimum number of times that the call is expected.
941      * @param maxCount
942      * the maximum number of times that the call is expected.
943      * @throws IllegalStateException
944      * if the mock object is in replay state, if no method was
945      * called on the mock object before. or if the last method
946      * called on the mock does not return
947      * <code>byte, short, char, int, or long</code>.
948      */

949     public void setReturnValue(long value, int minCount, int maxCount) {
950         try {
951             state.setReturnValue(value, new Range(minCount, maxCount));
952         } catch (RuntimeExceptionWrapper e) {
953             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
954         }
955     }
956
957     /**
958      * Records that the mock object will expect the last method call between
959      * <code>minCount</code> and <code>maxCount</code> times, and will react
960      * by returning the provided return value.
961      *
962      * @param value
963      * the return value.
964      * @param minCount
965      * the minimum number of times that the call is expected.
966      * @param maxCount
967      * the maximum number of times that the call is expected.
968      * @throws IllegalStateException
969      * if the mock object is in replay state, if no method was
970      * called on the mock object before. or if the last method
971      * called on the mock does not return <code>float</code>.
972      */

973     public void setReturnValue(float value, int minCount, int maxCount) {
974         try {
975             state.setReturnValue(value, new Range(minCount, maxCount));
976         } catch (RuntimeExceptionWrapper e) {
977             throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
978         }
979     }
980
981     /**
982      * Records that the mock object will expect the last method call between
983      * <code>minCount</code> and <code>maxCount</code> times, and will react
984      * by returning the provided return value.
985      *
986      * @param value
987      * the return value.
988      * @param minCount
989      * the minimum number of times that the call is expected.
990      * @param maxCount
991      * the maximum number of times that the call is expected.
992      * @throws IllegalStateException
993      * if the mock object is in replay state, if no method was
994      * called on the mock object before. or if the last method
995      * called on the mock does not return <code>double</code>.
996      */

997     public void setReturnValue(double value, int minCount, int maxCount) {
998         try {
999             state.setReturnValue(value, new Range(minCount, maxCount));
1000        } catch (RuntimeExceptionWrapper e) {
1001            throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
1002        }
1003    }
1004
1005    /**
1006     * Records that the mock object will expect the last method call between
1007     * <code>minCount</code> and <code>maxCount</code> times, and will react
1008     * by returning the provided return value.
1009     *
1010     * @param value
1011     * the return value.
1012     * @param minCount
1013     * the minimum number of times that the call is expected.
1014     * @param maxCount
1015     * the maximum number of times that the call is expected.
1016     * @throws IllegalStateException
1017     * if the mock object is in replay state, if no method was
1018     * called on the mock object before. or if the last method
1019     * called on the mock does not return an object.
1020     * @throws IllegalArgumentException
1021     * if the provided return value is not compatible to the return
1022     * value of the last method called on the mock object.
1023     */

1024    public void setReturnValue(Object JavaDoc value, int minCount, int maxCount) {
1025        try {
1026            state.setReturnValue(value, new Range(minCount, maxCount));
1027        } catch (RuntimeExceptionWrapper e) {
1028            throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
1029        }
1030    }
1031
1032    /**
1033     * Exactly one call.
1034     */

1035    public static final Range ONE = new Range(1);
1036
1037    /**
1038     * One or more calls.
1039     */

1040    public static final Range ONE_OR_MORE = new Range(1, Integer.MAX_VALUE);
1041
1042    /**
1043     * Zero or more calls.
1044     */

1045    public static final Range ZERO_OR_MORE = new Range(0, Integer.MAX_VALUE);
1046
1047    /**
1048     * Matches if each expected argument is equal to the corresponding actual
1049     * argument.
1050     */

1051    public static final ArgumentsMatcher EQUALS_MATCHER = new EqualsMatcher();
1052
1053    /**
1054     * Matches always.
1055     */

1056    public static final ArgumentsMatcher ALWAYS_MATCHER = new AlwaysMatcher();
1057
1058    /**
1059     * Matches if each expected argument is equal to the corresponding actual
1060     * argument for non-array arguments; array arguments are compared with the
1061     * appropriate <code>java.util.Arrays.equals()</code> -method.
1062     */

1063    public static final ArgumentsMatcher ARRAY_MATCHER = new ArrayMatcher();
1064
1065    /**
1066     * Sets the default ArgumentsMatcher for all methods of the mock object. The
1067     * matcher must be set before any behavior is defined on the mock object.
1068     *
1069     * @throws IllegalStateException
1070     * if called in replay state, or if any behavior is already
1071     * defined on the mock object.
1072     */

1073    public void setDefaultMatcher(ArgumentsMatcher matcher) {
1074        try {
1075            state.setDefaultMatcher(matcher);
1076        } catch (RuntimeExceptionWrapper e) {
1077            throw (RuntimeException JavaDoc) e.getRuntimeException().fillInStackTrace();
1078        }
1079    }
1080
1081    /**
1082     * Same as {@link MockControl#setReturnValue(boolean)}. For explanation,
1083     * see "Convenience Methods for Return Values" in the EasyMock
1084     * documentation.
1085     *
1086     * @param ignored
1087     * an ignored value.
1088     */

1089    public void expectAndReturn(boolean ignored, boolean value) {
1090        setReturnValue(value);
1091    }
1092
1093    /**
1094     * Same as {@link MockControl#setReturnValue(long)}. For explanation, see
1095     * "Convenience Methods for Return Values" in the EasyMock documentation.
1096     *
1097     * @param ignored
1098     * an ignored value.
1099     */

1100    public void expectAndReturn(long ignored, long value) {
1101        setReturnValue(value);
1102    }
1103
1104    /**
1105     * Same as {@link MockControl#setReturnValue(float)}. For explanation, see
1106     * "Convenience Methods for Return Values" in the EasyMock documentation.
1107     *
1108     * @param ignored
1109     * an ignored value.
1110     */

1111    public void expectAndReturn(float ignored, float value) {
1112        setReturnValue(value);
1113    }
1114
1115    /**
1116     * Same as {@link MockControl#setReturnValue(double)}. For explanation, see
1117     * "Convenience Methods for Return Values" in the EasyMock documentation.
1118     *
1119     * @param ignored
1120     * an ignored value.
1121     */

1122    public void expectAndReturn(double ignored, double value) {
1123        setReturnValue(value);
1124    }
1125
1126    /**
1127     * Same as {@link MockControl#setReturnValue(Object)}. For explanation, see
1128     * "Convenience Methods for Return Values" in the EasyMock documentation.
1129     *
1130     * @param ignored
1131     * an ignored value.
1132     */

1133    public <V1, V2 extends V1> void expectAndReturn(V1 ignored, V2 value) {
1134        setReturnValue(value);
1135    }
1136
1137    /**
1138     * Same as {@link MockControl#setReturnValue(boolean, Range)}. For
1139     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1140     * documentation.
1141     *
1142     * @param ignored
1143     * an ignored value.
1144     */

1145    public void expectAndReturn(boolean ignored, boolean value, Range range) {
1146        setReturnValue(value, range);
1147    }
1148
1149    /**
1150     * Same as {@link MockControl#setReturnValue(long, Range)}. For
1151     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1152     * documentation.
1153     *
1154     * @param ignored
1155     * an ignored value.
1156     */

1157    public void expectAndReturn(long ignored, long value, Range range) {
1158        setReturnValue(value, range);
1159    }
1160
1161    /**
1162     * Same as {@link MockControl#setReturnValue(float, Range)}. For
1163     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1164     * documentation.
1165     *
1166     * @param ignored
1167     * an ignored value.
1168     */

1169    public void expectAndReturn(float ignored, float value, Range range) {
1170        setReturnValue(value, range);
1171    }
1172
1173    /**
1174     * Same as {@link MockControl#setReturnValue(double, Range)}. For
1175     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1176     * documentation.
1177     *
1178     * @param ignored
1179     * an ignored value.
1180     */

1181    public void expectAndReturn(double ignored, double value, Range range) {
1182        setReturnValue(value, range);
1183    }
1184
1185    /**
1186     * Same as {@link MockControl#setReturnValue(Object, Range)}. For
1187     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1188     * documentation.
1189     *
1190     * @param ignored
1191     * an ignored value.
1192     */

1193    public <V1, V2 extends V1> void expectAndReturn(V1 ignored, V2 value,
1194            Range range) {
1195        setReturnValue(value, range);
1196    }
1197
1198    /**
1199     * Same as {@link MockControl#setReturnValue(boolean, int)}. For
1200     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1201     * documentation.
1202     *
1203     * @param ignored
1204     * an ignored value.
1205     */

1206    public void expectAndReturn(boolean ignored, boolean value, int count) {
1207        setReturnValue(value, count);
1208    }
1209
1210    /**
1211     * Same as {@link MockControl#setReturnValue(long, int)}. For explanation,
1212     * see "Convenience Methods for Return Values" in the EasyMock
1213     * documentation.
1214     *
1215     * @param ignored
1216     * an ignored value.
1217     */

1218    public void expectAndReturn(long ignored, long value, int count) {
1219        setReturnValue(value, count);
1220    }
1221
1222    /**
1223     * Same as {@link MockControl#setReturnValue(float, int)}. For explanation,
1224     * see "Convenience Methods for Return Values" in the EasyMock
1225     * documentation.
1226     *
1227     * @param ignored
1228     * an ignored value.
1229     */

1230    public void expectAndReturn(float ignored, float value, int count) {
1231        setReturnValue(value, count);
1232    }
1233
1234    /**
1235     * Same as {@link MockControl#setReturnValue(double, int)}. For
1236     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1237     * documentation.
1238     *
1239     * @param ignored
1240     * an ignored value.
1241     */

1242    public void expectAndReturn(double ignored, double value, int count) {
1243        setReturnValue(value, count);
1244    }
1245
1246    /**
1247     * Same as {@link MockControl#setReturnValue(Object, int)}. For
1248     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1249     * documentation.
1250     *
1251     * @param ignored
1252     * an ignored value.
1253     */

1254    public <V1, V2 extends V1> void expectAndReturn(V1 ignored, V2 value,
1255            int count) {
1256        setReturnValue(value, count);
1257    }
1258
1259    /**
1260     * Same as {@link MockControl#setReturnValue(boolean, int, int)}. For
1261     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1262     * documentation.
1263     *
1264     * @param ignored
1265     * an ignored value.
1266     */

1267    public void expectAndReturn(boolean ignored, boolean value, int min, int max) {
1268        setReturnValue(value, min, max);
1269    }
1270
1271    /**
1272     * Same as {@link MockControl#setReturnValue(long, int, int)}. For
1273     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1274     * documentation.
1275     *
1276     * @param ignored
1277     * an ignored value.
1278     */

1279    public void expectAndReturn(long ignored, long value, int min, int max) {
1280        setReturnValue(value, min, max);
1281    }
1282
1283    /**
1284     * Same as {@link MockControl#setReturnValue(float, int, int)}. For
1285     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1286     * documentation.
1287     *
1288     * @param ignored
1289     * an ignored value.
1290     */

1291    public void expectAndReturn(float ignored, float value, int min, int max) {
1292        setReturnValue(value, min, max);
1293    }
1294
1295    /**
1296     * Same as {@link MockControl#setReturnValue(double, int, int)}. For
1297     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1298     * documentation.
1299     *
1300     * @param ignored
1301     * an ignored value.
1302     */

1303    public void expectAndReturn(double ignored, double value, int min, int max) {
1304        setReturnValue(value, min, max);
1305    }
1306
1307    /**
1308     * Same as {@link MockControl#setReturnValue(Object, int, int)}. For
1309     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1310     * documentation.
1311     *
1312     * @param ignored
1313     * an ignored value.
1314     */

1315    public <V1, V2 extends V1> void expectAndReturn(V1 ignored, V2 value,
1316            int min, int max) {
1317        setReturnValue(value, min, max);
1318    }
1319
1320    /**
1321     * Same as {@link MockControl#setThrowable(Throwable)}. For explanation,
1322     * see "Convenience Methods for Throwables" in the EasyMock documentation.
1323     *
1324     * @param ignored
1325     * an ignored value.
1326     */

1327    public void expectAndThrow(boolean ignored, Throwable JavaDoc throwable) {
1328        setThrowable(throwable);
1329    }
1330
1331    /**
1332     * Same as {@link MockControl#setThrowable(Throwable)}. For explanation,
1333     * see "Convenience Methods for Throwables" in the EasyMock documentation.
1334     *
1335     * @param ignored
1336     * an ignored value.
1337     */

1338    public void expectAndThrow(long ignored, Throwable JavaDoc throwable) {
1339        setThrowable(throwable);
1340    }
1341
1342    /**
1343     * Same as {@link MockControl#setThrowable(Throwable)}. For explanation,
1344     * see "Convenience Methods for Throwables" in the EasyMock documentation.
1345     *
1346     * @param ignored
1347     * an ignored value.
1348     */

1349    public void expectAndThrow(float ignored, Throwable JavaDoc throwable) {
1350        setThrowable(throwable);
1351    }
1352
1353    /**
1354     * Same as {@link MockControl#setThrowable(Throwable)}. For explanation,
1355     * see "Convenience Methods for Throwables" in the EasyMock documentation.
1356     *
1357     * @param ignored
1358     * an ignored value.
1359     */

1360    public void expectAndThrow(double ignored, Throwable JavaDoc throwable) {
1361        setThrowable(throwable);
1362    }
1363
1364    /**
1365     * Same as {@link MockControl#setThrowable(Throwable)}. For explanation,
1366     * see "Convenience Methods for Throwables" in the EasyMock documentation.
1367     *
1368     * @param ignored
1369     * an ignored value.
1370     */

1371    public void expectAndThrow(Object JavaDoc ignored, Throwable JavaDoc throwable) {
1372        setThrowable(throwable);
1373    }
1374
1375    /**
1376     * Same as {@link MockControl#setThrowable(Throwable, Range)}. For
1377     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1378     * documentation.
1379     *
1380     * @param ignored
1381     * an ignored value.
1382     */

1383    public void expectAndThrow(boolean ignored, Throwable JavaDoc throwable, Range range) {
1384        setThrowable(throwable, range);
1385    }
1386
1387    /**
1388     * Same as {@link MockControl#setThrowable(Throwable, Range)}. For
1389     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1390     * documentation.
1391     *
1392     * @param ignored
1393     * an ignored value.
1394     */

1395    public void expectAndThrow(long ignored, Throwable JavaDoc throwable, Range range) {
1396        setThrowable(throwable, range);
1397    }
1398
1399    /**
1400     * Same as {@link MockControl#setThrowable(Throwable, Range)}. For
1401     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1402     * documentation.
1403     *
1404     * @param ignored
1405     * an ignored value.
1406     */

1407    public void expectAndThrow(float ignored, Throwable JavaDoc throwable, Range range) {
1408        setThrowable(throwable, range);
1409    }
1410
1411    /**
1412     * Same as {@link MockControl#setThrowable(Throwable, Range)}. For
1413     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1414     * documentation.
1415     *
1416     * @param ignored
1417     * an ignored value.
1418     */

1419    public void expectAndThrow(double ignored, Throwable JavaDoc throwable, Range range) {
1420        setThrowable(throwable, range);
1421    }
1422
1423    /**
1424     * Same as {@link MockControl#setThrowable(Throwable, Range)}. For
1425     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1426     * documentation.
1427     *
1428     * @param ignored
1429     * an ignored value.
1430     */

1431    public void expectAndThrow(Object JavaDoc ignored, Throwable JavaDoc throwable, Range range) {
1432        setThrowable(throwable, range);
1433    }
1434
1435    /**
1436     * Same as {@link MockControl#setThrowable(Throwable, int)}. For
1437     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1438     * documentation.
1439     *
1440     * @param ignored
1441     * an ignored value.
1442     */

1443    public void expectAndThrow(boolean ignored, Throwable JavaDoc throwable, int count) {
1444        setThrowable(throwable, count);
1445    }
1446
1447    /**
1448     * Same as {@link MockControl#setThrowable(Throwable, int)}. For
1449     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1450     * documentation.
1451     *
1452     * @param ignored
1453     * an ignored value.
1454     */

1455    public void expectAndThrow(long ignored, Throwable JavaDoc throwable, int count) {
1456        setThrowable(throwable, count);
1457    }
1458
1459    /**
1460     * Same as {@link MockControl#setThrowable(Throwable, int)}. For
1461     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1462     * documentation.
1463     *
1464     * @param ignored
1465     * an ignored value.
1466     */

1467    public void expectAndThrow(float ignored, Throwable JavaDoc throwable, int count) {
1468        setThrowable(throwable, count);
1469    }
1470
1471    /**
1472     * Same as {@link MockControl#setThrowable(Throwable, int)}. For
1473     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1474     * documentation.
1475     *
1476     * @param ignored
1477     * an ignored value.
1478     */

1479    public void expectAndThrow(double ignored, Throwable JavaDoc throwable, int count) {
1480        setThrowable(throwable, count);
1481    }
1482
1483    /**
1484     * Same as {@link MockControl#setThrowable(Throwable, int)}. For
1485     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1486     * documentation.
1487     *
1488     * @param ignored
1489     * an ignored value.
1490     */

1491    public void expectAndThrow(Object JavaDoc ignored, Throwable JavaDoc throwable, int count) {
1492        setThrowable(throwable, count);
1493    }
1494
1495    /**
1496     * Same as {@link MockControl#setThrowable(Throwable, int, int)}. For
1497     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1498     * documentation.
1499     *
1500     * @param ignored
1501     * an ignored value.
1502     */

1503    public void expectAndThrow(boolean ignored, Throwable JavaDoc throwable, int min,
1504            int max) {
1505        setThrowable(throwable, min, max);
1506    }
1507
1508    /**
1509     * Same as {@link MockControl#setThrowable(Throwable, int, int)}. For
1510     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1511     * documentation.
1512     *
1513     * @param ignored
1514     * an ignored value.
1515     */

1516    public void expectAndThrow(long ignored, Throwable JavaDoc throwable, int min,
1517            int max) {
1518        setThrowable(throwable, min, max);
1519    }
1520
1521    /**
1522     * Same as {@link MockControl#setThrowable(Throwable, int, int)}. For
1523     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1524     * documentation.
1525     *
1526     * @param ignored
1527     * an ignored value.
1528     */

1529    public void expectAndThrow(float ignored, Throwable JavaDoc throwable, int min,
1530            int max) {
1531        setThrowable(throwable, min, max);
1532    }
1533
1534    /**
1535     * Same as {@link MockControl#setThrowable(Throwable, int, int)}. For
1536     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1537     * documentation.
1538     *
1539     * @param ignored
1540     * an ignored value.
1541     */

1542    public void expectAndThrow(double ignored, Throwable JavaDoc throwable, int min,
1543            int max) {
1544        setThrowable(throwable, min, max);
1545    }
1546
1547    /**
1548     * Same as {@link MockControl#setThrowable(Throwable, int, int)}. For
1549     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1550     * documentation.
1551     *
1552     * @param ignored
1553     * an ignored value.
1554     */

1555    public void expectAndThrow(Object JavaDoc ignored, Throwable JavaDoc throwable, int min,
1556            int max) {
1557        setThrowable(throwable, min, max);
1558    }
1559
1560    /**
1561     * Same as {@link MockControl#setDefaultReturnValue(boolean)}. For
1562     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1563     * documentation.
1564     *
1565     * @param ignored
1566     * an ignored value.
1567     */

1568    public void expectAndDefaultReturn(boolean ignored, boolean value) {
1569        setDefaultReturnValue(value);
1570    }
1571
1572    /**
1573     * Same as {@link MockControl#setDefaultReturnValue(long)}. For
1574     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1575     * documentation.
1576     *
1577     * @param ignored
1578     * an ignored value.
1579     */

1580    public void expectAndDefaultReturn(long ignored, long value) {
1581        setDefaultReturnValue(value);
1582    }
1583
1584    /**
1585     * Same as {@link MockControl#setDefaultReturnValue(float)}. For
1586     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1587     * documentation.
1588     *
1589     * @param ignored
1590     * an ignored value.
1591     */

1592    public void expectAndDefaultReturn(float ignored, float value) {
1593        setDefaultReturnValue(value);
1594    }
1595
1596    /**
1597     * Same as {@link MockControl#setDefaultReturnValue(double)}. For
1598     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1599     * documentation.
1600     *
1601     * @param ignored
1602     * an ignored value.
1603     */

1604    public void expectAndDefaultReturn(double ignored, double value) {
1605        setDefaultReturnValue(value);
1606    }
1607
1608    /**
1609     * Same as {@link MockControl#setDefaultReturnValue(Object)}. For
1610     * explanation, see "Convenience Methods for Return Values" in the EasyMock
1611     * documentation.
1612     *
1613     * @param ignored
1614     * an ignored value.
1615     */

1616    public <V1, V2 extends V1> void expectAndDefaultReturn(V1 ignored, V2 value) {
1617        setDefaultReturnValue(value);
1618    }
1619
1620    /**
1621     * Same as {@link MockControl#setDefaultThrowable(Throwable)}. For
1622     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1623     * documentation.
1624     *
1625     * @param ignored
1626     * an ignored value.
1627     */

1628    public void expectAndDefaultThrow(boolean ignored, Throwable JavaDoc throwable) {
1629        setDefaultThrowable(throwable);
1630    }
1631
1632    /**
1633     * Same as {@link MockControl#setDefaultThrowable(Throwable)}. For
1634     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1635     * documentation.
1636     *
1637     * @param ignored
1638     * an ignored value.
1639     */

1640    public void expectAndDefaultThrow(long ignored, Throwable JavaDoc throwable) {
1641        setDefaultThrowable(throwable);
1642    }
1643
1644    /**
1645     * Same as {@link MockControl#setDefaultThrowable(Throwable)}. For
1646     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1647     * documentation.
1648     *
1649     * @param ignored
1650     * an ignored value.
1651     */

1652    public void expectAndDefaultThrow(float ignored, Throwable JavaDoc throwable) {
1653        setDefaultThrowable(throwable);
1654    }
1655
1656    /**
1657     * Same as {@link MockControl#setDefaultThrowable(Throwable)}. For
1658     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1659     * documentation.
1660     *
1661     * @param ignored
1662     * an ignored value.
1663     */

1664    public void expectAndDefaultThrow(double ignored, Throwable JavaDoc throwable) {
1665        setDefaultThrowable(throwable);
1666    }
1667
1668    /**
1669     * Same as {@link MockControl#setDefaultThrowable(Throwable)}. For
1670     * explanation, see "Convenience Methods for Throwables" in the EasyMock
1671     * documentation.
1672     *
1673     * @param ignored
1674     * an ignored value.
1675     */

1676    public void expectAndDefaultThrow(Object JavaDoc ignored, Throwable JavaDoc throwable) {
1677        setDefaultThrowable(throwable);
1678    }
1679}
Popular Tags