tech.grasshopper.pdf.pojo.cucumber.BaseEntity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cucumber-pdf-report Show documentation
Show all versions of cucumber-pdf-report Show documentation
Generates Cucumber execution report in PDF format
The newest version!
package tech.grasshopper.pdf.pojo.cucumber;
import java.time.Duration;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.experimental.SuperBuilder;
import tech.grasshopper.pdf.exception.PdfReportException;
@Data
@SuperBuilder
public abstract class BaseEntity {
protected String name;
protected Status status;
protected LocalDateTime startTime;
protected LocalDateTime endTime;
public Duration calculatedDuration() {
return Duration.between(startTime, endTime);
}
protected void checkTimeData() {
if (startTime == null)
throw new PdfReportException("Start Time not present for " + this.getClass().getName() + " - " + getName());
if (endTime == null)
throw new PdfReportException("End Time not present for " + this.getClass().getName() + " - " + getName());
if (startTime.compareTo(endTime) > 0)
throw new PdfReportException(
"Start Time is later than End time for " + this.getClass().getName() + " - " + getName());
}
public void checkData() {
checkTimeData();
}
}