summaryrefslogtreecommitdiffstats
path: root/junit4/src/main/java/org/junit/internal/runners/model/ReflectiveCallable.java
diff options
context:
space:
mode:
Diffstat (limited to 'junit4/src/main/java/org/junit/internal/runners/model/ReflectiveCallable.java')
-rw-r--r--junit4/src/main/java/org/junit/internal/runners/model/ReflectiveCallable.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/junit4/src/main/java/org/junit/internal/runners/model/ReflectiveCallable.java b/junit4/src/main/java/org/junit/internal/runners/model/ReflectiveCallable.java
new file mode 100644
index 0000000..9150d90
--- /dev/null
+++ b/junit4/src/main/java/org/junit/internal/runners/model/ReflectiveCallable.java
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.junit.internal.runners.model;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * When invoked, throws the exception from the reflected method, rather than
+ * wrapping it in an InvocationTargetException.
+ */
+public abstract class ReflectiveCallable {
+ public Object run() throws Throwable {
+ try {
+ return runReflectiveCall();
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+
+ protected abstract Object runReflectiveCall() throws Throwable;
+} \ No newline at end of file