|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| package org.easymock.internal; |
|
6 |
| |
|
7 |
| public class Result { |
|
8 |
| private Object value; |
|
9 |
| |
|
10 |
| private boolean doThrow; |
|
11 |
| |
|
12 |
259
| private Result(Object value, boolean doThrow) {
|
|
13 |
259
| this.value = value;
|
|
14 |
259
| this.doThrow = doThrow;
|
|
15 |
| } |
|
16 |
| |
|
17 |
45
| public static Result createThrowResult(Throwable throwable) {
|
|
18 |
45
| return new Result(throwable, true);
|
|
19 |
| } |
|
20 |
| |
|
21 |
214
| public static Result createReturnResult(Object value) {
|
|
22 |
214
| return new Result(value, false);
|
|
23 |
| } |
|
24 |
| |
|
25 |
300
| public Object returnObjectOrThrowException() throws Throwable {
|
|
26 |
300
| if (doThrow) {
|
|
27 |
67
| throw new ThrowableWrapper((Throwable) value);
|
|
28 |
| } else { |
|
29 |
233
| return value;
|
|
30 |
| } |
|
31 |
| } |
|
32 |
| } |