
io.qameta.allure.tree.TreeGroup 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.tree;
import io.qameta.allure.entity.LabelName;
import io.qameta.allure.entity.TestResult;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author charlie (Dmitry Baev).
*/
@FunctionalInterface
public interface TreeGroup {
List getGroupNames();
static TreeGroup values(String... values) {
return () -> Arrays.asList(values);
}
static TreeGroup values(List values) {
return () -> Collections.unmodifiableList(values);
}
static TreeGroup allByLabel(TestResult result, LabelName labelName, String... defaultGroups) {
Set groups = result.findAll(labelName, Collectors.toSet());
if (groups.isEmpty()) {
return values(defaultGroups);
}
return values(new ArrayList<>(groups));
}
static TreeGroup oneByLabel(TestResult result, LabelName labelName, String defaultGroup) {
return values(result.findOne(labelName).orElse(defaultGroup));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy