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

com.github.fscheffer.arras.test.PerThreadTestContext Maven / Gradle / Ivy

package com.github.fscheffer.arras.test;


public class PerThreadTestContext {

    private static final ThreadLocal CONTEXT = new ThreadLocal();

    public TestContext get() {
        return CONTEXT.get();
    }

    public void set(TestContext newContext) {
        CONTEXT.set(newContext);
    }

    public void destroy() {

        TestContext context = CONTEXT.get();

        CONTEXT.set(null);

        if (context != null) {
            // Note: We can't close the driver in a shutdown hook
            context.getDriver().close();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy