Class Returns
- java.lang.Object
-
- org.mockito.internal.stubbing.answers.Returns
-
- All Implemented Interfaces:
java.io.Serializable
,Answer<java.lang.Object>
,ValidableAnswer
public class Returns extends java.lang.Object implements Answer<java.lang.Object>, ValidableAnswer, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
private java.lang.Object
value
-
Constructor Summary
Constructors Constructor Description Returns(java.lang.Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
answer(InvocationOnMock invocation)
private java.lang.String
printReturnType()
private boolean
returnsNull()
private java.lang.Class<?>
returnType()
java.lang.String
toString()
void
validateFor(InvocationOnMock invocation)
Validation of the answer at stub time for the given invocation.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
value
private final java.lang.Object value
-
-
Method Detail
-
answer
public java.lang.Object answer(InvocationOnMock invocation) throws java.lang.Throwable
-
validateFor
public void validateFor(InvocationOnMock invocation)
Description copied from interface:ValidableAnswer
Validation of the answer at stub time for the given invocation.This method will be called by Mockito.
The implementation must throw an MockitoException to indicate that this answer is not valid for the given invocation. If the validation succeed the implementation must simply return without throwing.
- Specified by:
validateFor
in interfaceValidableAnswer
- Parameters:
invocation
- The stubbed invocation
-
printReturnType
private java.lang.String printReturnType()
-
returnType
private java.lang.Class<?> returnType()
-
returnsNull
private boolean returnsNull()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-