org.allurefw.report.entity.WithSummary Maven / Gradle / Ivy
The newest version!
package org.allurefw.report.entity;
import javax.xml.bind.annotation.XmlElement;
import java.util.function.BinaryOperator;
/**
* @author Dmitry Baev [email protected]
* Date: 31.01.16
*/
public interface WithSummary extends WithSteps, WithAttachments {
BinaryOperator reduceOperator = (first, second) -> new Summary()
.withSteps(first.getSteps() + second.getSteps())
.withAttachments(first.getAttachments() + second.getAttachments());
@XmlElement
default Summary getSummary() {
Summary current = new Summary()
.withSteps((long) getSteps().size())
.withAttachments((long) getAttachments().size());
return getSteps().stream()
.map(Step::getSummary)
.reduce(current, reduceOperator);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy