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

de.leanovate.pragmatic.ioc.TestInjectors Maven / Gradle / Ivy

The newest version!
package de.leanovate.pragmatic.ioc;

import java.util.function.Function;

public class TestInjectors {
    public static final TestScope TEST_SCOPE = new TestScope();

    public static void init() {

        if (Scopes.singletonScope != TEST_SCOPE) {
            Scopes.singletonScope = TEST_SCOPE;
        }
    }

    public static void bind(Object instance) {

        init();
        TEST_SCOPE.bind(instance);
    }

    public static  void bind(Class injectedClass, T instance) {

        init();
        TEST_SCOPE.bind(injectedClass, instance);
    }

    public static  T bindMock(Class injectedClass) {

        init();
        return TEST_SCOPE.bindMock(injectedClass);
    }

    public static void reset() {

        init();
        TEST_SCOPE.reset(null);
    }

    public static void reset(Function mocker) {

        init();
        TEST_SCOPE.reset(mocker);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy