Package net.thucydides.core.steps

Source Code of net.thucydides.core.steps.ErrorConvertor

package net.thucydides.core.steps;

import net.thucydides.core.webdriver.WebdriverAssertionError;

import java.io.Serializable;

public class ErrorConvertor implements Serializable {

    private final Throwable throwable;
    public static ErrorConvertor forError(final Throwable throwable) {
        return new ErrorConvertor(throwable);
    }

    protected ErrorConvertor(Throwable throwable) {
        this.throwable = throwable;
    }

    public Throwable convertToAssertion() {
        if (RuntimeException.class.isAssignableFrom(throwable.getClass())) {
            return throwable;
        } else {
            return new WebdriverAssertionError(throwable);
        }
    }
}
TOP

Related Classes of net.thucydides.core.steps.ErrorConvertor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.