nl.hsac.fitnesse.slim.interaction.ExceptionHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hsac-fitnesse-fixtures Show documentation
Show all versions of hsac-fitnesse-fixtures Show documentation
Fixtures to assist in testing via FitNesse
package nl.hsac.fitnesse.slim.interaction;
import java.lang.reflect.InvocationTargetException;
public class ExceptionHelper {
private ExceptionHelper() {}
public static Throwable stripReflectionException(Throwable t) {
Throwable result = t;
if (t instanceof InvocationTargetException) {
InvocationTargetException e = (InvocationTargetException) t;
if (e.getCause() != null) {
result = e.getCause();
} else {
result = e.getTargetException();
}
}
return result;
}
public static InvocationTargetException wrapInReflectionException(Throwable t) {
InvocationTargetException result;
if (t instanceof InvocationTargetException) {
result = (InvocationTargetException) t;
} else {
result = new InvocationTargetException(t, t.getMessage());
}
return result;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy