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

org.mockito.internal.rules.JUnitRule Maven / Gradle / Ivy

There is a newer version: 2.0.2-beta
Show newest version
package org.mockito.internal.rules;

import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

/**
 * Internal implementation.
 */
public class JUnitRule {
    private Object object;

    public JUnitRule(Object object) {
        this.object = object;
    }

    public Statement apply(final Statement base, Description description) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                MockitoAnnotations.initMocks(object);
                base.evaluate();
                Mockito.validateMockitoUsage();
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy