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

org.fluentlenium.adapter.ThreadLocalFluentControlContainer Maven / Gradle / Ivy

There is a newer version: 5.0.4
Show newest version
package org.fluentlenium.adapter;

import org.fluentlenium.core.FluentControl;
import org.fluentlenium.core.FluentDriver;

/**
 * Alternative {@link FluentControlContainer} implementation, using a ThreadLocal variable to store the
 * {@link FluentDriver} instance.
 */
public class ThreadLocalFluentControlContainer implements FluentControlContainer {
    private final ThreadLocal fluentControls = new ThreadLocal<>();

    @Override
    public FluentControl getFluentControl() {
        return fluentControls.get();
    }

    @Override
    public void setFluentControl(FluentControl fluentControl) {
        if (fluentControl == null) {
            fluentControls.remove();
        } else {
            fluentControls.set(fluentControl);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy