All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.screenplay.Task Maven / Gradle / Ivy

There is a newer version: 4.2.9
Show newest version
package net.serenitybdd.screenplay;

import net.serenitybdd.core.steps.Instrumented;

import java.util.Arrays;
import java.util.function.Consumer;

/**
 * A marker class to indicate that a Performable represents a higher level business task,
 * rather than a system interaction.
 */
public interface Task extends Performable {
    static  AnonymousTask where(T... steps) {
        return Instrumented.instanceOf(AnonymousTask.class).withProperties(HumanReadableTaskName.forCurrentMethod(), Arrays.asList(steps));
    }

    static TaskBuilder called(String title) { return new TaskBuilder(title); }

    /**
     * Create a new Performable Task made up of a list of Performables.
     */
    static  AnonymousTask where(String title, T... steps) {
        return Instrumented.instanceOf(AnonymousTask.class).withProperties(title, Arrays.asList(steps));
    }

    static  AnonymousPerformableFunction where(Consumer performableOperation) {
        return Instrumented.instanceOf(AnonymousPerformableFunction.class).withProperties(HumanReadableTaskName.forCurrentMethod(),
                                                                                          performableOperation);
    }

    static  AnonymousPerformableFunction where(String title, Consumer performableOperation) {
        return Instrumented.instanceOf(AnonymousPerformableFunction.class).withProperties(title, performableOperation);
    }

    static  AnonymousPerformableRunnable thatPerforms(Runnable performableOperation) {
        return Instrumented.instanceOf(AnonymousPerformableRunnable.class).withProperties(HumanReadableTaskName.forCurrentMethod(), performableOperation);
    }

    static  AnonymousPerformableRunnable thatPerforms(String title, Runnable performableOperation) {
        return Instrumented.instanceOf(AnonymousPerformableRunnable.class).withProperties(title, performableOperation);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy