Clover Coverage Report - EasyMock 3.0
Coverage timestamp: sam. mai 8 2010 14:37:27 CEST
0   192   0   -
0   23   -   0
0     -  
1    
 
  IMocksControl       Line # 27 0 - 0 0 - -1.0
 
No Tests
 
1    /**
2    * Copyright 2001-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16   
17    package org.easymock;
18   
19    import java.lang.reflect.Method;
20   
21    /**
22    * Controls all the mock objects created by it. For details, see the EasyMock
23    * documentation.
24    *
25    * @author OFFIS, Tammo Freese
26    */
 
27    public interface IMocksControl {
28   
29    /**
30    * Creates a mock object that implements the given interface.
31    *
32    * @param <T>
33    * the interface or class that the mock object should
34    * implement/extend.
35    * @param toMock
36    * the interface or class that the mock object should
37    * implement/extend.
38    * @return the mock object.
39    */
40    <T> T createMock(Class<T> toMock);
41   
42    /**
43    * Creates a mock object that implements the given interface.
44    *
45    * @param <T>
46    * the interface or class that the mock object should
47    * implement/extend.
48    * @param name
49    * the name of the mock object.
50    * @param toMock
51    * the interface or class that the mock object should
52    * implement/extend.
53    * @return the mock object.
54    * @throws IllegalArgumentException
55    * if the name is not a valid Java identifier.
56    */
57    <T> T createMock(String name, Class<T> toMock);
58   
59    /**
60    * Creates a mock object that implements the given class.
61    *
62    * @param <T>
63    * the class that the mock object should extend.
64    * @param toMock
65    * the class that the mock object should extend.
66    * @param mockedMethods
67    * methods that will be mocked, other methods will behave
68    * normally
69    * @return the mock object.
70    *
71    * @deprecated Use {@link EasyMock#createMockBuilder(Class)} instead
72    */
73    @Deprecated
74    <T> T createMock(Class<T> toMock, Method... mockedMethods);
75   
76    /**
77    * Creates a mock object that implements the given class.
78    *
79    * @param <T>
80    * the class that the mock object should extend.
81    * @param toMock
82    * the class that the mock object should extend.
83    * @param constructorArgs
84    * constructor and parameters used to instantiate the mock.
85    * @param mockedMethods
86    * methods that will be mocked, other methods will behave
87    * normally
88    * @return the mock object.
89    *
90    * @deprecated Use {@link EasyMock#createMockBuilder(Class)} instead
91    */
92    @Deprecated
93    <T> T createMock(Class<T> toMock, ConstructorArgs constructorArgs, Method... mockedMethods);
94   
95    /**
96    * Creates a mock object that implements the given class.
97    *
98    * @param <T>
99    * the class that the mock object should extend.
100    * @param name
101    * the name of the mock object.
102    * @param toMock
103    * the class that the mock object should extend.
104    * @param mockedMethods
105    * methods that will be mocked, other methods will behave
106    * normally
107    * @return the mock object.
108    *
109    * @deprecated Use {@link EasyMock#createMockBuilder(Class)} instead
110    */
111    @Deprecated
112    <T> T createMock(String name, Class<T> toMock, Method... mockedMethods);
113   
114    /**
115    * Creates a mock object that implements the given class.
116    *
117    * @param <T>
118    * the class that the mock object should extend.
119    * @param name
120    * the name of the mock object.
121    * @param toMock
122    * the class that the mock object should extend.
123    * @param constructorArgs
124    * constructor and parameters used to instantiate the mock.
125    * @param mockedMethods
126    * methods that will be mocked, other methods will behave
127    * normally
128    * @return the mock object.
129    *
130    * @deprecated Use {@link EasyMock#createMockBuilder(Class)} instead
131    */
132    @Deprecated
133    <T> T createMock(String name, Class<T> toMock, ConstructorArgs constructorArgs, Method... mockedMethods);
134   
135    /**
136    * Removes all expectations for the mock objects of this control.
137    */
138    void reset();
139   
140    /**
141    * Removes all expectations for the mock objects of this control and turn
142    * them to nice mocks.
143    */
144    void resetToNice();
145   
146    /**
147    * Removes all expectations for the mock objects of this control and turn
148    * them to default mocks.
149    */
150    void resetToDefault();
151   
152    /**
153    * Removes all expectations for the mock objects of this control and turn
154    * them to strict mocks.
155    */
156    void resetToStrict();
157   
158    /**
159    * Switches the control from record mode to replay mode.
160    */
161    void replay();
162   
163    /**
164    * Verifies that all expectations were met.
165    */
166    void verify();
167   
168    /**
169    * Switches order checking on and off.
170    *
171    * @param state
172    * <code>true</code> switches order checking on,
173    * <code>false</code> switches it off.
174    */
175    void checkOrder(boolean state);
176   
177    /**
178    * Makes the mock thread safe.
179    *
180    * @param threadSafe
181    * If the mock should be thread safe or not
182    */
183    void makeThreadSafe(boolean threadSafe);
184   
185    /**
186    * Check that the mock is called from only one thread
187    *
188    * @param shouldBeUsedInOneThread
189    * If it should be used in one thread only or not
190    */
191    void checkIsUsedInOneThread(boolean shouldBeUsedInOneThread);
192    }