Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.easymock.EasyMock
public class EasyMock
extends java.lang.Object
Method Summary | |
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static boolean |
|
static byte |
|
static char |
|
static double |
|
static float |
|
static int |
|
static long |
|
static short |
|
static boolean |
|
static byte |
|
static char |
|
static double |
|
static float |
|
static int |
|
static long |
|
static Object |
|
static short |
|
static boolean[] |
|
static byte[] |
|
static char[] |
|
static double[] |
|
static float[] |
|
static int[] |
|
static long[] |
|
static short[] |
|
static void |
|
static String |
|
static IMocksControl |
|
static IMocksControl |
|
static IMocksControl |
|
static String |
|
static boolean |
|
static byte |
|
static char |
|
static double |
|
static double |
|
static float |
|
static float |
|
static int |
|
static long |
|
static short |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static String |
|
static byte |
|
static double |
|
static float |
|
static int |
|
static long |
|
static short |
|
static Object[] |
|
static byte |
|
static double |
|
static float |
|
static int |
|
static long |
|
static short |
|
static Object |
|
static byte |
|
static double |
|
static float |
|
static int |
|
static long |
|
static short |
|
static byte |
|
static double |
|
static float |
|
static int |
|
static long |
|
static short |
|
static String |
|
static boolean |
|
static byte |
|
static char |
|
static double |
|
static float |
|
static int |
|
static long |
|
static short |
|
static Object |
|
static boolean |
|
static byte |
|
static char |
|
static double |
|
static float |
|
static int |
|
static long |
|
static short |
|
static void |
|
static void |
|
static void |
|
static String |
|
static void |
|
public staticT and(T first, T second)
Expects an Object that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
null
.
public staticT cmp(T value, Comparator comparator, LogicalOperator operator)
Expects an argument that will be compared using the provided comparator. The following comparison will take place:comparator.compare(actual, expected) operator 0
For details, see the EasyMock documentation.
- Parameters:
value
- the given value.comparator
- Comparator used to compare the actual with expected value.operator
- The comparison operator.
- Returns:
null
public staticT createMock(Class toMock)
Creates a mock object that implements the given interface, order checking is disabled by default.
- Parameters:
toMock
- the class of the interface that the mock object should implement.
- Returns:
- the mock object.
public staticT createMock(String name, Class toMock)
Creates a mock object that implements the given interface, order checking is disabled by default.
- Parameters:
name
- the name of the mock object.toMock
- the class of the interface that the mock object should implement.
- Returns:
- the mock object.
public staticT createNiceMock(Class toMock)
Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return0
,null
orfalse
for unexpected invocations.
- Parameters:
toMock
- the class of the interface that the mock object should implement.
- Returns:
- the mock object.
public staticT createNiceMock(String name, Class toMock)
Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return0
,null
orfalse
for unexpected invocations.
- Parameters:
name
- the name of the mock object.toMock
- the class of the interface that the mock object should implement.
- Returns:
- the mock object.
public staticT createStrictMock(Class toMock)
Creates a mock object that implements the given interface, order checking is enabled by default.
- Parameters:
toMock
- the class of the interface that the mock object should implement.
- Returns:
- the mock object.
public staticT createStrictMock(String name, Class toMock)
Creates a mock object that implements the given interface, order checking is enabled by default.
- Parameters:
name
- the name of the mock object.toMock
- the class of the interface that the mock object should implement.
- Returns:
- the mock object.
public staticT eq(T value)
Expects an Object that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
null
.
public staticT isA(Class clazz)
Expects an object implementing the given class. For details, see the EasyMock documentation.
- Parameters:
clazz
- the class of the accepted type.
- Returns:
null
.
public staticT not(T first)
Expects an Object that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
null
.
public staticT or(T first, T second)
Expects an Object that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
null
.
public staticT same(T value)
Expects an Object that is the same as the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
null
.
public staticT[] aryEq(T[] value)
Expects an Object array that is equal to the given array, i.e. it has to have the same type, length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static boolean and(boolean first, boolean second)
Expects a boolean that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
false
.
public static byte and(byte first, byte second)
Expects a byte that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static char and(char first, char second)
Expects a char that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static double and(double first, double second)
Expects a double that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static float and(float first, float second)
Expects a float that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static int and(int first, int second)
Expects an int that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static long and(long first, long second)
Expects a long that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static short and(short first, short second)
Expects a short that matches both given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static boolean anyBoolean()
Expects any boolean argument. For details, see the EasyMock documentation.
- Returns:
false
.
public static byte anyByte()
Expects any byte argument. For details, see the EasyMock documentation.
- Returns:
0
.
public static char anyChar()
Expects any char argument. For details, see the EasyMock documentation.
- Returns:
0
.
public static double anyDouble()
Expects any double argument. For details, see the EasyMock documentation.
- Returns:
0
.
public static float anyFloat()
Expects any float argument. For details, see the EasyMock documentation.
- Returns:
0
.
public static int anyInt()
Expects any int argument. For details, see the EasyMock documentation.
- Returns:
0
.
public static long anyLong()
Expects any long argument. For details, see the EasyMock documentation.
- Returns:
0
.
public static Object anyObject()
Expects any Object argument. For details, see the EasyMock documentation.
- Returns:
null
.
public static short anyShort()
Expects any short argument. For details, see the EasyMock documentation.
- Returns:
0
.
public static boolean[] aryEq(boolean[] value)
Expects a boolean array that is equal to the given array, i.e. it has to have the same length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static byte[] aryEq(byte[] value)
Expects a byte array that is equal to the given array, i.e. it has to have the same length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static char[] aryEq(char[] value)
Expects a char array that is equal to the given array, i.e. it has to have the same length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static double[] aryEq(double[] value)
Expects a double array that is equal to the given array, i.e. it has to have the same length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static float[] aryEq(float[] value)
Expects a float array that is equal to the given array, i.e. it has to have the same length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static int[] aryEq(int[] value)
Expects an int array that is equal to the given array, i.e. it has to have the same length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static long[] aryEq(long[] value)
Expects a long array that is equal to the given array, i.e. it has to have the same length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static short[] aryEq(short[] value)
Expects a short array that is equal to the given array, i.e. it has to have the same length, and each element has to be equal.
- Parameters:
value
- the given arry.
- Returns:
null
.
public static void checkOrder(Object mock, boolean state)
Switches order checking of the given mock object (more exactly: the control of the mock object) the on and off. For details, see the EasyMock documentation.
- Parameters:
mock
- the mock object.state
-true
switches order checking on,false
switches it off.
public static String contains(String substring)
Expects a string that contains the given substring. For details, see the EasyMock documentation.
- Parameters:
substring
- the substring.
- Returns:
null
.
public static IMocksControl createControl()
Creates a control, order checking is disabled by default.
- Returns:
- the control.
public static IMocksControl createNiceControl()
Creates a control, order checking is disabled by default, and the mock objects created by this control will return0
,null
orfalse
for unexpected invocations.
- Returns:
- the control.
public static IMocksControl createStrictControl()
Creates a control, order checking is enabled by default.
- Returns:
- the control.
public static String endsWith(String suffix)
Expects a string that ends with the given suffix. For details, see the EasyMock documentation.
- Parameters:
suffix
- the suffix.
- Returns:
null
.
public static boolean eq(boolean value)
Expects a boolean that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
0
.
public static byte eq(byte value)
Expects a byte that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
0
.
public static char eq(char value)
Expects a char that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
0
.
public static double eq(double value)
Expects a double that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
0
.
public static double eq(double value, double delta)
Expects a double that has an absolute difference to the given value that is less than the given delta. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.delta
- the given delta.
- Returns:
0
.
public static float eq(float value)
Expects a float that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
0
.
public static float eq(float value, float delta)
Expects a float that has an absolute difference to the given value that is less than the given delta. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.delta
- the given delta.
- Returns:
0
.
public static int eq(int value)
Expects an int that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
0
.
public static long eq(long value)
Expects a long that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
0
.
public static short eq(short value)
Expects a short that is equal to the given value.
- Parameters:
value
- the given value.
- Returns:
0
.
public static> T cmpEq(Comparable value)
Expects a comparable argument equals to the given value according to their compareTo method. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
null
.
public static> T geq(Comparable value)
Expects a comparable argument greater than or equal the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
null
.
public static> T gt(Comparable value)
Expects a comparable argument greater than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
null
.
public static> T leq(Comparable value)
Expects a comparable argument less than or equal the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
null
.
public static> T lt(Comparable value)
Expects a comparable argument less than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
null
.
public static String find(String regex)
Expects a string that contains a substring that matches the given regular expression. For details, see the EasyMock documentation.
- Parameters:
regex
- the regular expression.
- Returns:
null
.
public static byte geq(byte value)
Expects a byte argument greater than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static double geq(double value)
Expects a double argument greater than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static float geq(float value)
Expects a float argument greater than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static int geq(int value)
Expects an int argument greater than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static long geq(long value)
Expects a long argument greater than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static short geq(short value)
Expects a short argument greater than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static Object[] getCurrentArguments()
Returns the arguments of the current mock method call, if inside anIAnswer
callback - be careful here, reordering parameters of method changes the semantics of your tests.
- Returns:
- the arguments of the current mock method call.
public static byte gt(byte value)
Expects a byte argument greater than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static double gt(double value)
Expects a double argument greater than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static float gt(float value)
Expects a float argument greater than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static int gt(int value)
Expects an int argument greater than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static long gt(long value)
Expects a long argument greater than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static short gt(short value)
Expects a short argument greater than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static Object isNull()
Expects null.
- Returns:
null
.
public static byte leq(byte value)
Expects a byte argument less than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static double leq(double value)
Expects a double argument less than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static float leq(float value)
Expects a float argument less than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static int leq(int value)
Expects an int argument less than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static long leq(long value)
Expects a long argument less than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static short leq(short value)
Expects a short argument less than or equal to the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static byte lt(byte value)
Expects a byte argument less than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static double lt(double value)
Expects a double argument less than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static float lt(float value)
Expects a float argument less than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static int lt(int value)
Expects an int argument less than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static long lt(long value)
Expects a long argument less than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static short lt(short value)
Expects a short argument less than the given value. For details, see the EasyMock documentation.
- Parameters:
value
- the given value.
- Returns:
0
.
public static String matches(String regex)
Expects a string that matches the given regular expression. For details, see the EasyMock documentation.
- Parameters:
regex
- the regular expression.
- Returns:
null
.
public static boolean not(boolean first)
Expects a boolean that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
false
.
public static byte not(byte first)
Expects a byte that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
0
.
public static char not(char first)
Expects a char that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
0
.
public static double not(double first)
Expects a double that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
0
.
public static float not(float first)
Expects a float that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
0
.
public static int not(int first)
Expects an int that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
0
.
public static long not(long first)
Expects a long that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
0
.
public static short not(short first)
Expects a short that does not match the given expectation.
- Parameters:
first
- placeholder for the expectation.
- Returns:
0
.
public static Object notNull()
Expects not null.
- Returns:
null
.
public static boolean or(boolean first, boolean second)
Expects a boolean that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
false
.
public static byte or(byte first, byte second)
Expects a byte that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static char or(char first, char second)
Expects a char that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static double or(double first, double second)
Expects a double that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static float or(float first, float second)
Expects a float that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static int or(int first, int second)
Expects an int that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static long or(long first, long second)
Expects a long that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static short or(short first, short second)
Expects a short that matches one of the given expectations.
- Parameters:
first
- placeholder for the first expectation.second
- placeholder for the second expectation.
- Returns:
0
.
public static void replay(Object... mocks)
Switches the given mock objects (more exactly: the controls of the mock objects) to replay mode. For details, see the EasyMock documentation.
- Parameters:
mocks
- the mock objects.
public static void reportMatcher(IArgumentMatcher matcher)
Reports an argument matcher. This method is needed to define own argument matchers. For details, see the EasyMock documentation.
- Parameters:
matcher
-
public static void reset(Object... mocks)
Resets the given mock objects (more exactly: the controls of the mock objects). For details, see the EasyMock documentation.
- Parameters:
mocks
- the mock objects.
public static String startsWith(String prefix)
Expects a string that starts with the given prefix. For details, see the EasyMock documentation.
- Parameters:
prefix
- the prefix.
- Returns:
null
.
public static void verify(Object... mocks)
Verifies the given mock objects (more exactly: the controls of the mock objects).
- Parameters:
mocks
- the mock objects.