
com.qantium.uisteps.allure.tests.steps.Steps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of uisteps-allure Show documentation
Show all versions of uisteps-allure Show documentation
Allure extension for uisteps-core
The newest version!
package com.qantium.uisteps.allure.tests.steps;
import ru.yandex.qatools.allure.annotations.Step;
import java.util.function.Function;
import java.util.function.Supplier;
public abstract class Steps {
protected final String desc;
private Steps(String desc) {
this.desc = desc;
}
public static void step(String desc, Runnable step) {
new SimpleStep(desc, step).run();
}
public static R step(String desc, T param, Function step) {
return new FunctionStep<>(desc, step).apply(param);
}
public static T step(String desc, Supplier step) {
return new SupplierStep<>(desc, step).get();
}
private static class SupplierStep extends Steps {
private final Supplier step;
private SupplierStep(String desc, Supplier step) {
super(desc);
this.step = step;
}
public T get() {
return step(desc);
}
@Step("{0}")
private T step(String desc) {
return step.get();
}
}
private static class FunctionStep extends Steps {
private final Function step;
private FunctionStep(String desc, Function step) {
super(desc);
this.step = step;
}
public R apply(T param) {
return step(desc, param);
}
@Step("{0}")
private R step(String desc, T param) {
return step.apply(param);
}
}
private static class SimpleStep extends Steps {
private final Runnable step;
private SimpleStep(String desc, Runnable step) {
super(desc);
this.step = step;
}
public void run() {
step(desc);
}
@Step("{0}")
private void step(String desc) {
step.run();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy