mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
317 lines
14 KiB
HTML
317 lines
14 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--NewPage-->
|
|
<HTML>
|
|
<HEAD>
|
|
<!-- Generated by javadoc (build 1.5.0_22) on Mon May 24 23:03:27 CEST 2010 -->
|
|
<TITLE>
|
|
Deprecated List (Mockito API)
|
|
</TITLE>
|
|
|
|
|
|
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
|
|
|
<SCRIPT type="text/javascript">
|
|
function windowTitle()
|
|
{
|
|
parent.document.title="Deprecated List (Mockito API)";
|
|
}
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
</NOSCRIPT>
|
|
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="white" onload="windowTitle();">
|
|
|
|
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<A NAME="navbar_top"><!-- --></A>
|
|
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_top_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<TR ALIGN="center" VALIGN="top">
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Deprecated</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
</EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
PREV
|
|
NEXT</FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="index.html?deprecated-list.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="deprecated-list.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_top"></A>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
|
|
<HR>
|
|
<CENTER>
|
|
<H2>
|
|
<B>Deprecated API</B></H2>
|
|
</CENTER>
|
|
<HR SIZE="4" NOSHADE>
|
|
<B>Contents</B><UL>
|
|
<LI><A HREF="#interface">Deprecated Interfaces</A>
|
|
<LI><A HREF="#class">Deprecated Classes</A>
|
|
<LI><A HREF="#enum">Deprecated Enums</A>
|
|
<LI><A HREF="#annotation_type">Deprecated Annotation Types</A>
|
|
<LI><A HREF="#method">Deprecated Methods</A>
|
|
<LI><A HREF="#constructor">Deprecated Constructors</A>
|
|
</UL>
|
|
|
|
<A NAME="interface"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Deprecated Interfaces</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/ReturnValues.html" title="interface in org.mockito">org.mockito.ReturnValues</A>
|
|
<BR>
|
|
<I><b>Instead, please use <A HREF="org/mockito/stubbing/Answer.html" title="interface in org.mockito.stubbing"><CODE>Answer</CODE></A> interface</b>
|
|
<p>
|
|
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.
|
|
<p>
|
|
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.
|
|
<p>
|
|
Configures return values for an unstubbed invocation
|
|
<p>
|
|
Can be used in <A HREF="org/mockito/Mockito.html#mock(java.lang.Class, org.mockito.ReturnValues)"><CODE>Mockito.mock(Class, ReturnValues)</CODE></A></I> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<A NAME="class"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Deprecated Classes</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/runners/MockitoJUnit44Runner.html" title="class in org.mockito.runners">org.mockito.runners.MockitoJUnit44Runner</A>
|
|
<BR>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<A NAME="enum"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Deprecated Enums</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/internal/stubbing/defaultanswers/Answers.html" title="enum in org.mockito.internal.stubbing.defaultanswers">org.mockito.internal.stubbing.defaultanswers.Answers</A>
|
|
<BR>
|
|
<I>- please use Answers from top Mockito package: <A HREF="org/mockito/Answers.html" title="enum in org.mockito"><CODE>Answers</CODE></A>
|
|
<p>
|
|
<b>WARNING</b> Those answers no longer are used by the framework!!! Please use <A HREF="org/mockito/Answers.html" title="enum in org.mockito"><CODE>Answers</CODE></A>
|
|
<p>
|
|
See <A HREF="org/mockito/Mockito.html" title="class in org.mockito"><CODE>Mockito</CODE></A> for more information.</I> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<A NAME="annotation_type"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Deprecated Annotation Types</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/MockitoAnnotations.Mock.html" title="annotation in org.mockito">org.mockito.MockitoAnnotations.Mock</A>
|
|
<BR>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<A NAME="method"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Deprecated Methods</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/configuration/AnnotationEngine.html#createMockFor(java.lang.annotation.Annotation, java.lang.reflect.Field)">org.mockito.configuration.AnnotationEngine.createMockFor(Annotation, Field)</A>
|
|
<BR>
|
|
<I>Please use AnnotationProcessor 'execute' method instead that is more robust
|
|
<p>
|
|
Creates mock, ArgumentCaptor or wraps field instance in spy object.
|
|
Only if of correct annotation type.</I> </TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/configuration/IMockitoConfiguration.html#getReturnValues()">org.mockito.configuration.IMockitoConfiguration.getReturnValues()</A>
|
|
<BR>
|
|
<I><b>Please use <A HREF="org/mockito/configuration/IMockitoConfiguration.html#getDefaultAnswer()"><CODE>IMockitoConfiguration.getDefaultAnswer()</CODE></A></b>
|
|
<p>
|
|
Steps:
|
|
<p>
|
|
1. Leave the implementation of getReturnValues() method empty - it's not going to be used anyway.
|
|
<p>
|
|
2. Implement getDefaultAnswer() instead.
|
|
<p>
|
|
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.
|
|
<p>
|
|
See javadoc <A HREF="org/mockito/ReturnValues.html" title="interface in org.mockito"><CODE>ReturnValues</CODE></A> for info why this method was deprecated
|
|
<p>
|
|
Allows configuring the default return values of unstubbed invocations
|
|
<p>
|
|
See javadoc for <A HREF="org/mockito/configuration/IMockitoConfiguration.html" title="interface in org.mockito.configuration"><CODE>IMockitoConfiguration</CODE></A></I> </TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/configuration/DefaultMockitoConfiguration.html#getReturnValues()">org.mockito.configuration.DefaultMockitoConfiguration.getReturnValues()</A>
|
|
<BR>
|
|
</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/Mockito.html#mock(java.lang.Class, org.mockito.ReturnValues)">org.mockito.Mockito.mock(Class<T>, ReturnValues)</A>
|
|
<BR>
|
|
<I><b>Please use mock(Foo.class, defaultAnswer);</b>
|
|
<p>
|
|
See <A HREF="org/mockito/Mockito.html#mock(java.lang.Class, org.mockito.stubbing.Answer)"><CODE>Mockito.mock(Class, Answer)</CODE></A>
|
|
<p>
|
|
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.
|
|
<p>
|
|
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.
|
|
<p>
|
|
Obviously return values are used only when you don't stub the method call.
|
|
|
|
<pre>
|
|
Foo mock = mock(Foo.class, Mockito.RETURNS_SMART_NULLS);
|
|
Foo mockTwo = mock(Foo.class, new YourOwnReturnValues());
|
|
</pre>
|
|
|
|
<p>See examples in javadoc for <A HREF="org/mockito/Mockito.html" title="class in org.mockito"><CODE>Mockito</CODE></A> class</p></I> </TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/Mockito.html#stubVoid(T)">org.mockito.Mockito.stubVoid(T)</A>
|
|
<BR>
|
|
<I>Use <A HREF="org/mockito/Mockito.html#doThrow(java.lang.Throwable)"><CODE>Mockito.doThrow(Throwable)</CODE></A> method for stubbing voids</I> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<A NAME="constructor"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Deprecated Constructors</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><A HREF="org/mockito/ArgumentCaptor.html#ArgumentCaptor()">org.mockito.ArgumentCaptor()</A>
|
|
<BR>
|
|
<I><b>Please use factory method <A HREF="org/mockito/ArgumentCaptor.html#forClass(java.lang.Class)"><CODE>ArgumentCaptor.forClass(Class)</CODE></A> to create captors</b>
|
|
<p>
|
|
This is required to avoid NullPointerExceptions when autoUnboxing primitive types.
|
|
See issue 99.
|
|
<p>
|
|
Example:
|
|
<pre>
|
|
ArgumentCaptor<Person> argument = ArgumentCaptor.forClass(Person.class);
|
|
verify(mock).doSomething(argument.capture());
|
|
assertEquals("John", argument.getValue().getName());
|
|
</pre></I> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<HR>
|
|
|
|
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<A NAME="navbar_bottom"><!-- --></A>
|
|
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<TR ALIGN="center" VALIGN="top">
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Deprecated</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
</EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
PREV
|
|
NEXT</FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="index.html?deprecated-list.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="deprecated-list.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_bottom"></A>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
|
|
<HR>
|
|
|
|
</BODY>
|
|
</HTML>
|