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

com.fitbur.mockito.configuration.IMockitoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package com.fitbur.mockito.configuration;

import com.fitbur.mockito.internal.stubbing.defaultanswers.ReturnsEmptyValues;
import com.fitbur.mockito.stubbing.Answer;

/**
 * Use it to configure Mockito. For now there are not many configuration options but it may change in future.
 * 

* In most cases you don't really need to configure Mockito. For example in case of working with legacy code, * when you might want to have different 'mocking style' this interface might be helpful. * A reason of configuring Mockito might be if you disagree with the {@link ReturnsEmptyValues} unstubbed mocks return. *

* To configure Mockito create exactly com.fitbur.mockito.configuration.MockitoConfiguration class that implements this interface. *

* Configuring Mockito is completely optional - nothing happens if there isn't any com.fitbur.mockito.configuration.MockitoConfiguration on the classpath. *

* com.fitbur.mockito.configuration.MockitoConfiguration must implement IMockitoConfiguration or extend {@link DefaultMockitoConfiguration} *

* Mockito will store single instance of com.fitbur.mockito.configuration.MockitoConfiguration per thread (using ThreadLocal). * For sanity of your tests, don't make the implementation stateful. *

* If you have comments on Mockito configuration feature don't hesitate to write to [email protected] */ public interface IMockitoConfiguration { /** * Allows configuring the default answers of unstubbed invocations *

* See javadoc for {@link IMockitoConfiguration} */ Answer getDefaultAnswer(); /** * Configures annotations for mocks *

* See javadoc for {@link IMockitoConfiguration} */ AnnotationEngine getAnnotationEngine(); /** * This should be turned on unless you're a Mockito developer and you wish * to have verbose (read: messy) stack traces that only few understand (eg: * Mockito developers) *

* See javadoc for {@link IMockitoConfiguration} * * @return if Mockito should clean stack traces */ boolean cleansStackTrace(); /** * Allow objenesis to cache classes. If you're in an environment where classes * are dynamically reloaded, you can disable this to avoid classcast exceptions. */ boolean enableClassCache(); }