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

io.qameta.allure.entity.WithStatistic Maven / Gradle / Ivy

There is a newer version: 2.30.0
Show newest version
package io.qameta.allure.entity;

/**
 * @author Dmitry Baev [email protected]
 *         Date: 31.01.16
 */
public interface WithStatistic {

    Statistic getStatistic();

    void setStatistic(Statistic statistic);

    default void updateStatistic(Statistic other) {
        getStatistic().setFailed(other.getFailed() + getStatistic().getFailed());
        getStatistic().setBroken(other.getBroken() + getStatistic().getBroken());
        getStatistic().setPassed(other.getPassed() + getStatistic().getPassed());
        getStatistic().setSkipped(other.getSkipped() + getStatistic().getSkipped());
        getStatistic().setUnknown(other.getUnknown() + getStatistic().getUnknown());
    }

    default void updateStatistic(WithStatus withStatus) {
        if (withStatus == null) {
            return;
        }
        if (getStatistic() == null) {
            setStatistic(new Statistic());
        }
        getStatistic().update(withStatus.getStatus());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy