forked from mockito/mockito
/
IMethods.java
309 lines (175 loc) · 7.02 KB
/
IMethods.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage;
import java.io.IOException;
import java.nio.charset.CharacterCodingException;
import java.util.*;
public interface IMethods {
boolean booleanReturningMethod();
Boolean booleanObjectReturningMethod();
byte byteReturningMethod();
Byte byteObjectReturningMethod();
short shortReturningMethod();
Short shortObjectReturningMethod();
char charReturningMethod();
Character charObjectReturningMethod();
int intReturningMethod();
Integer integerReturningMethod();
long longReturningMethod();
Long longObjectReturningMethod();
float floatReturningMethod();
Float floatObjectReturningMethod();
double doubleReturningMethod();
Double doubleObjectReturningMethod();
Object objectReturningMethod(Object... objects);
Object objectReturningMethodNoArgs();
String oneArg(boolean value);
String oneArg(Boolean value);
String forBoolean(Boolean value);
String oneArg(byte value);
String oneArg(Byte value);
String forByte(Byte value);
String oneArg(short value);
String oneArg(Short value);
String forShort(Short value);
String oneArg(char value);
String oneArg(Character value);
String forCharacter(Character value);
String oneArg(int value);
String oneArg(Integer value);
String forInteger(Integer value);
String oneArg(long value);
String oneArg(Long value);
String forLong(Long value);
String oneArg(float value);
String oneArg(Float value);
String forFloat(Float value);
String oneArg(double value);
String oneArg(Double value);
String forDouble(Double value);
String oneArg(Object value);
String oneArg(String value);
String throwsNothing(boolean value);
String throwsIOException(int count) throws IOException;
String throwsError(int count);
String simpleMethod();
String differentMethod();
String differentMethod(String argument);
String otherMethod();
String simpleMethod(String argument);
String simpleMethod(Collection<?> collection);
String simpleMethod(Object argument);
String simpleMethod(int argument);
String simpleMethod(String argOne, Integer argTwo);
String simpleMethod(String one, Integer two, Integer three, Integer four, Integer five);
String simpleMethod(
String one, Integer two, Integer three, Integer four, Integer five, Integer six);
String simpleMethod(String one, String[] two);
Object threeArgumentMethod(int valueOne, Object valueTwo, String valueThree);
String threeArgumentMethodWithStrings(int valueOne, String valueTwo, String valueThree);
String threeArgumentVarArgsMethod(int valueOne, String valueTwo, String... valueThree);
String fourArgumentMethod(int valueOne, String valueTwo, String valueThree, boolean[] array);
String fourArgumentVarArgsMethod(
int valueOne, String valueTwo, int valueThree, String... valueFour);
String fiveArgumentVarArgsMethod(
int valueOne, String valueTwo, int valueThree, String valueFour, String... valueFive);
String sixArgumentVarArgsMethod(
int valueOne,
String valueTwo,
int valueThree,
String valueFour,
String valueFive,
String... valueSix);
int arrayVarargsMethod(String[]... arrayVarArgs);
void twoArgumentMethod(int one, int two);
void arrayMethod(String[] strings);
String oneArray(boolean[] array);
String oneArray(byte[] array);
String oneArray(char[] array);
String oneArray(double[] array);
String oneArray(float[] array);
String oneArray(int[] array);
String oneArray(long[] array);
String oneArray(short[] array);
String oneArray(Object[] array);
String canThrowException() throws CharacterCodingException;
String oneArray(String[] array);
void varargsString(int i, String... string);
Object varargsObject(int i, Object... object);
void varargsbyte(byte... bytes);
int varargs(Object... object);
String varargsReturningString(Object... object);
int varargs(String... string);
void mixedVarargs(Object i, String... string);
String mixedVarargsReturningString(Object i, String... string);
String[] mixedVarargsReturningStringArray(Object i, String... string);
Object[] mixedVarargsReturningObjectArray(Object i, String... string);
List<String> listReturningMethod(Object... objects);
LinkedList<String> linkedListReturningMethod();
String toString();
String toString(String foo);
void voidMethod();
Void voidReturningMethod();
String forList(List<String> list);
String forSet(Set<String> anySet);
String forMap(Map<String, String> map);
String forCollection(Collection<String> collection);
String forIterable(Iterable<String> iterable);
Object[] arrayReturningMethod();
IMethods iMethodsReturningMethod();
String stringReturningMethod();
Object objectArgMethod(Object str);
Object listArgMethod(List<String> list);
Object collectionArgMethod(Collection<String> collection);
Object iterableArgMethod(Iterable<String> collection);
Object setArgMethod(Set<String> set);
void longArg(long longArg);
void intArgumentMethod(int i);
int intArgumentReturningInt(int i);
boolean equals(String str);
boolean equals();
int hashCode(String str);
int toIntPrimitive(Integer i);
Integer toIntWrapper(int i);
Integer toIntWrapperVarArgs(int i, Object... varargs);
String forObject(Object object);
<T> String genericToString(T arg);
void overloadedMethodWithSameClassNameArguments(java.sql.Date javaDate, Date date);
void overloadedMethodWithSameClassNameArguments(Date date, java.sql.Date javaDate);
void overloadedMethodWithDifferentClassNameArguments(String String, Integer i);
void overloadedMethodWithDifferentClassNameArguments(Integer i, String string);
void overloadedMethodWithSameClassNameArguments(
java.sql.Date javaDate, String string, Date date);
void overloadedMethodWithSameClassNameArguments(
Date date, String string, java.sql.Date javaDate);
/**
* Using this class to test cases where two classes have same simple name
*/
public static class Date {
private int value;
public Date(int value) {
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Date date = (Date) o;
return value == date.value;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
}
}