1b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot/**
2b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot *
3b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot */
4b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotpackage org.junit.internal.runners.model;
5b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot
6b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotimport java.lang.reflect.InvocationTargetException;
7b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot
8b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot/**
9b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * When invoked, throws the exception from the reflected method, rather than
10b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot * wrapping it in an InvocationTargetException.
11b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot */
12b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabotpublic abstract class ReflectiveCallable {
13b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot	public Object run() throws Throwable {
14b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		try {
15b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot			return runReflectiveCall();
16b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		} catch (InvocationTargetException e) {
17b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot			throw e.getTargetException();
18b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot		}
19b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot	}
20b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot
21b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot	protected abstract Object runReflectiveCall() throws Throwable;
22b3823db9f1192d8c81345740b3e65bd6738ba55bBrett Chabot}