io.qameta.allure.entity.WithSummary Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of allure-plugin-api Show documentation
Show all versions of allure-plugin-api Show documentation
Module allure-plugin-api of Allure Framework.
package io.qameta.allure.entity;
import javax.xml.bind.annotation.XmlElement;
import java.util.List;
import static java.util.Collections.emptyList;
import static java.util.Objects.isNull;
/**
* @author charlie (Dmitry Baev).
*/
public interface WithSummary {
List getSteps();
List getAttachments();
List getParameters();
@XmlElement
default long getStepsCount() {
final List steps = isNull(getSteps()) ? emptyList() : getSteps();
final long stepsCount = steps.size();
return steps.stream()
.map(Step::getStepsCount)
.reduce(stepsCount, Long::sum);
}
@XmlElement
default long getAttachmentsCount() {
final List attachments = isNull(getAttachments()) ? emptyList() : getAttachments();
final List steps = isNull(getSteps()) ? emptyList() : getSteps();
final long attachmentsCount = isNull(attachments) ? 0 : attachments.size();
return steps.stream()
.map(Step::getAttachmentsCount)
.reduce(attachmentsCount, Long::sum);
}
@XmlElement
default boolean hasContent() {
final List attachments = isNull(getAttachments()) ? emptyList() : getAttachments();
final List steps = isNull(getSteps()) ? emptyList() : getSteps();
final List parameters = isNull(getParameters()) ? emptyList() : getParameters();
return steps.size() + attachments.size() + parameters.size() > 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy