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

org.mockito.Answers Maven / Gradle / Ivy

There is a newer version: 2.0.2-beta
Show newest version
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito;

import org.mockito.internal.stubbing.answers.CallsRealMethods;
import org.mockito.internal.stubbing.defaultanswers.GloballyConfiguredAnswer;
import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs;
import org.mockito.internal.stubbing.defaultanswers.ReturnsMocks;
import org.mockito.internal.stubbing.defaultanswers.ReturnsSmartNulls;
import org.mockito.stubbing.Answer;

/**
 * Enumeration of pre-configured mock answers
 * 

* You can use it to pass extra parameters to @Mock annotation, see more info here: {@link Mock} *

* Example: *

 *   @Mock(answer = RETURNS_DEEP_STUBS) UserProvider userProvider;
 * 
* This is not the full list of Answers available in Mockito. Some interesting answers can be found in org.mockito.stubbing.answers package. */ public enum Answers { RETURNS_DEFAULTS(new GloballyConfiguredAnswer()), RETURNS_SMART_NULLS(new ReturnsSmartNulls()), RETURNS_MOCKS(new ReturnsMocks()), RETURNS_DEEP_STUBS(new ReturnsDeepStubs()), CALLS_REAL_METHODS(new CallsRealMethods()) ; private Answer implementation; private Answers(Answer implementation) { this.implementation = implementation; } public Answer get() { return implementation; } }