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

uk.camsw.rxjava.test.dsl.given.BaseGiven Maven / Gradle / Ivy

The newest version!
package uk.camsw.rxjava.test.dsl.given;

import rx.functions.Func1;
import uk.camsw.rxjava.test.dsl.when.IWhen;
import uk.camsw.rxjava.test.dsl.scenario.ExecutionContext;

import java.time.Duration;
import java.time.temporal.TemporalUnit;

public abstract class BaseGiven implements IGiven {

    private final ExecutionContext context;

    protected BaseGiven(ExecutionContext context) {
        this.context = context;
    }

    @Override
    public GIVEN errorsAreHandled() {
        context.setHandleErrors(true);
        return self();
    }

    @Override
    public GIVEN theRenderer(Func1 renderer) {
        context.setRenderer(renderer);
        return self();
    }

    @Override
    public GIVEN asyncTimeoutOf(long timeout, TemporalUnit unit) {
        return asyncTimeoutOf(Duration.of(timeout, unit));
    }

    @Override
    public GIVEN asyncTimeoutOf(Duration duration) {
        context.setAsyncTimeout(duration);
        return self();
    }

    private GIVEN self() {
        return (GIVEN) this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy