All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.novatec.testit.livingdoc.util.ExceptionImposter Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package info.novatec.testit.livingdoc.util;

@SuppressWarnings("serial")
public class ExceptionImposter extends RuntimeException {
    private final Throwable imposterized;

    public static RuntimeException imposterize(Throwable t) {
        if (t instanceof RuntimeException) {
            return ( RuntimeException ) t;
        }

        return new ExceptionImposter(t);
    }

    public ExceptionImposter(Throwable e) {
        super(e.getMessage(), e.getCause());
        imposterized = e;
        setStackTrace(e.getStackTrace());
    }

    public Throwable getRealException() {
        return imposterized;
    }

    @Override
    public String toString() {
        return imposterized.toString();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy