@@ -97,36 +97,34 @@ public abstract aspect AbstractMethodMockingControl percflow(mockStaticsTestMeth
97
97
98
98
public void verify () {
99
99
if (verified != calls. size()) {
100
- throw new IllegalStateException (" Expected " + calls. size()
101
- + " calls, received " + verified);
100
+ throw new IllegalStateException (" Expected " + calls. size() + " calls, received " + verified);
102
101
}
103
102
}
104
103
105
104
/**
106
- * Validate the call and provide the expected return value
107
- * @param lastSig
108
- * @param args
109
- * @return
105
+ * Validate the call and provide the expected return value.
110
106
*/
111
107
public Object respond (String lastSig , Object [] args ) {
112
108
Call call = nextCall();
113
109
CallResponse responseType = call. responseType;
114
110
if (responseType == CallResponse . return_) {
115
111
return call. returnValue(lastSig, args);
116
- } else if (responseType == CallResponse . throw_) {
117
- return (RuntimeException )call. throwException(lastSig, args);
118
- } else if (responseType == CallResponse . nothing) {
112
+ }
113
+ else if (responseType == CallResponse . throw_) {
114
+ return call. throwException(lastSig, args);
115
+ }
116
+ else if (responseType == CallResponse . nothing) {
119
117
// do nothing
120
118
}
121
119
throw new IllegalStateException (" Behavior of " + call + " not specified" );
122
120
}
123
121
124
122
private Call nextCall () {
125
- if ( verified > calls . size() - 1 ) {
126
- throw new IllegalStateException ( " Expected " + calls. size()
127
- + " calls, received " + verified);
123
+ verified++ ;
124
+ if (verified > calls. size()) {
125
+ throw new IllegalStateException ( " Expected " + calls . size() + " calls, received " + verified);
128
126
}
129
- return calls. get(verified++ );
127
+ return calls. get(verified);
130
128
}
131
129
132
130
public void expectCall (String lastSig , Object lastArgs []) {
@@ -171,7 +169,8 @@ public abstract aspect AbstractMethodMockingControl percflow(mockStaticsTestMeth
171
169
expectations. expectCall(thisJoinPointStaticPart. toLongString(), thisJoinPoint. getArgs());
172
170
// Return value doesn't matter
173
171
return null ;
174
- } else {
172
+ }
173
+ else {
175
174
return expectations. respond(thisJoinPointStaticPart. toLongString(), thisJoinPoint. getArgs());
176
175
}
177
176
}
0 commit comments