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

org.testinfected.hamcrest.ExceptionImposter Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
package org.testinfected.hamcrest;

public class ExceptionImposter extends RuntimeException {
    private final Exception imposterized;

    public static RuntimeException imposterize(Exception e) {
        if (e instanceof RuntimeException) return (RuntimeException) e;

        return new ExceptionImposter(e);
    }

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

    public Exception getRealException() {
        return imposterized;
    }

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy