com.aventstack.extentreports.TestAttributeTestContextProvider Maven / Gradle / Ivy
package com.aventstack.extentreports;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import com.aventstack.extentreports.model.Test;
import com.aventstack.extentreports.model.TestAttribute;
import com.aventstack.extentreports.model.TestAttributeTestContext;
@SuppressWarnings("rawtypes")
public class TestAttributeTestContextProvider {
private List testAttrCollection;
public TestAttributeTestContextProvider() {
testAttrCollection = new ArrayList<>();
}
@SuppressWarnings("unchecked")
public void setAttributeContext(T attr, Test test) {
Optional testOptionalTestContext = testAttrCollection
.stream()
.filter(x -> x.getName().equals(attr.getName()))
.findFirst();
if (testOptionalTestContext.isPresent()) {
List testList = testOptionalTestContext.get().getTestList();
boolean b = testList
.stream()
.anyMatch(t -> t.getID() == test.getID());
if (!b)
testOptionalTestContext.get().setTest(test);
testOptionalTestContext.get().refreshTestStatusCounts();
}
else {
TestAttributeTestContext testAttrContext = new TestAttributeTestContext(attr);
testAttrContext.setTest(test);
testAttrCollection.add(testAttrContext);
}
}
public List getTestAttributeTestContextList() {
return testAttrCollection;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy