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