tech.grasshopper.extent.data.pojo.Step Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of extent-excel-report Show documentation
Show all versions of extent-excel-report Show documentation
Excel Extent Reporter for Cucumber
package tech.grasshopper.extent.data.pojo;
import java.util.ArrayList;
import java.util.List;
import lombok.Builder.Default;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
import tech.grasshopper.excel.report.exception.ExcelReportException;
@Data
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public class Step extends Executable {
private String keyword;
@Default
private List before = new ArrayList<>();
@Default
private List after = new ArrayList<>();
public List getBeforeAfterHooks() {
List hooks = new ArrayList<>();
hooks.addAll(before);
hooks.addAll(after);
return hooks;
}
public void addBeforeStepHook(Hook hook) {
before.add(hook);
}
public void addAfterStepHook(Hook hook) {
after.add(hook);
}
public void checkData() {
if (name == null || name.isEmpty())
throw new ExcelReportException("Step text is null or empty.");
if (keyword == null || keyword.isEmpty())
throw new ExcelReportException("Keyword is null or empty for step - " + getName());
if (status == null)
throw new ExcelReportException("No status present for step - " + getName());
super.checkData();
}
}