1
2
3 package org.virtualmock.call;
4
5 /***
6 * Represents a method invocation of an invoked call (which was invoked by the
7 * Class Under Test). This is a subclass of Call which only contains
8 * information which is specific to invoked calls.
9 *
10 * @author Chad Woolley
11 * @version $Revision: 1.12 $
12 */
13 public class InvokedCall extends Call {
14 /***
15 * The number of times that this invoked call has been successfully
16 * verified against a recorded call.
17 */
18 private int verificationCount = 0;
19
20 /***
21 * Creates a new InvokedCall object with no args, return value, or
22 * exception.
23 *
24 * @param signature the signature of the call
25 */
26 public InvokedCall(Signature signature) {
27 super(signature);
28 }
29
30 /***
31 * Creates a new InvokedCall object.
32 *
33 * @param signature the signature of the call
34 * @param argValues an array representing the values of the arguments
35 * passed to (or expected by) the call.
36 */
37 public InvokedCall(Signature signature, Object[] argValues) {
38 super(signature, argValues);
39 }
40
41 /***
42 * Creates a new InvokedCall object which has a return value.
43 *
44 * @param signature the method signature for the call
45 * @param argValues an array representing the values of the arguments
46 * passed to (or expected by) the call.
47 * @param returnValue the value the call will return
48 */
49 public InvokedCall(Signature signature, Object[] argValues,
50 Object returnValue) {
51 super(signature, argValues, returnValue);
52 }
53
54 /***
55 * Creates a new InvokedCall object which throws an exception.
56 *
57 * @param signature the method signature for the call
58 * @param argValues an array representing the values of the arguments
59 * passed to (or expected by) the call.
60 * @param throwable the exception the call will throw
61 */
62 public InvokedCall(Signature signature, Object[] argValues,
63 Throwable throwable) {
64 super(signature, argValues, throwable);
65 }
66
67 /***
68 * DOCUMENT ME! (Method)
69 *
70 * @return DOCUMENT ME! (Method Return)
71 */
72 public int getVerificationCount() {
73 return verificationCount;
74 }
75
76 /***
77 * returns true if verification count is greater than zero.
78 *
79 * @return true if verification count is greater than zero.
80 */
81 public boolean isVerified() {
82 if (verificationCount > 0) {
83 return true;
84 }
85
86 return false;
87 }
88
89 /***
90 * Increments the internal verification count for this call by one.
91 */
92 public void incrementVerificationCount() {
93 verificationCount++;
94 }
95 }