|
||||||||||
PREV NEXT | FRAMES NO FRAMES |
Deprecated Interfaces | |
---|---|
org.mockito.ReturnValues
Instead, please use Answer interface
In rare cases your code might not compile with recent deprecation & changes. Very sorry for inconvenience but it had to be done in order to keep framework consistent. Why it is deprecated? ReturnValues is being replaced by Answer for better consistency & interoperability of the framework. Answer interface has been in Mockito for a while and it has the same responsibility as ReturnValues. There's no point in mainting exactly the same interfaces. Configures return values for an unstubbed invocation
Can be used in |
Deprecated Classes | |
---|---|
org.mockito.runners.MockitoJUnit44Runner
|
Deprecated Enums | |
---|---|
org.mockito.internal.stubbing.defaultanswers.Answers
- please use Answers from top Mockito package: Answers
WARNING Those answers no longer are used by the framework!!! Please use
See |
Deprecated Annotation Types | |
---|---|
org.mockito.MockitoAnnotations.Mock
|
Deprecated Methods | |
---|---|
org.mockito.verification.VerificationWithTimeout.atMost(int)
Deprecated validation with timeout combined with atMost simply does not make sense... The test would have passed immediately in the concurrent environment To avoid compilation erros upon upgrade the method is deprecated and it throws a "friendly reminder" exception. In future release we will remove timeout(x).atMost(y) from the API. Do you want to find out more? See issue 235 |
|
org.mockito.configuration.AnnotationEngine.createMockFor(Annotation, Field)
Please use AnnotationEngine.process(Class, Object) method instead that is more robust
Creates mock, ArgumentCaptor or wraps field instance in spy object. Only if of correct annotation type. |
|
org.mockito.internal.configuration.InjectingAnnotationEngine.createMockFor(Annotation, Field)
|
|
org.mockito.configuration.IMockitoConfiguration.getReturnValues()
Please use IMockitoConfiguration.getDefaultAnswer()
Steps: 1. Leave the implementation of getReturnValues() method empty - it's not going to be used anyway. 2. Implement getDefaultAnswer() instead. In rare cases your code might not compile with recent deprecation & changes. Very sorry for inconvenience but it had to be done in order to keep framework consistent.
See javadoc Allows configuring the default return values of unstubbed invocations
See javadoc for |
|
org.mockito.configuration.DefaultMockitoConfiguration.getReturnValues()
|
|
org.mockito.Mockito.mock(Class Please use mock(Foo.class, defaultAnswer);
See Why it is deprecated? ReturnValues is being replaced by Answer for better consistency & interoperability of the framework. Answer interface has been in Mockito for a while and it has the same responsibility as ReturnValues. There's no point in mainting exactly the same interfaces. Creates mock with a specified strategy for its return values. It's quite advanced feature and typically you don't need it to write decent tests. However it can be helpful when working with legacy systems. Obviously return values are used only when you don't stub the method call.
See examples in javadoc for |
|
org.mockito.Mockito.stubVoid(T)
Use Mockito.doThrow(Throwable) method for stubbing voids |
Deprecated Constructors | |
---|---|
org.mockito.ArgumentCaptor()
Please use factory method ArgumentCaptor.forClass(Class) to create captors
This is required to avoid NullPointerExceptions when autoUnboxing primitive types. See issue 99. Example: |
|
||||||||||
PREV NEXT | FRAMES NO FRAMES |