| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.easymock.EasyMock
public class EasyMock
| Constructor Summary | |
|---|---|
| EasyMock() | |
| Method Summary | ||
|---|---|---|
| static boolean | and(boolean first,
    boolean second)Expects a boolean that matches both given expectations. | |
| static byte | and(byte first,
    byte second)Expects a byte that matches both given expectations. | |
| static char | and(char first,
    char second)Expects a char that matches both given expectations. | |
| static double | and(double first,
    double second)Expects a double that matches both given expectations. | |
| static float | and(float first,
    float second)Expects a float that matches both given expectations. | |
| static int | and(int first,
    int second)Expects an int that matches both given expectations. | |
| static long | and(long first,
    long second)Expects a long that matches both given expectations. | |
| static short | and(short first,
    short second)Expects a short that matches both given expectations. | |
| static
 | and(T first,
    T second)Expects an Object that matches both given expectations. | |
| static boolean | anyBoolean()Expects any boolean argument. | |
| static byte | anyByte()Expects any byte argument. | |
| static char | anyChar()Expects any char argument. | |
| static double | anyDouble()Expects any double argument. | |
| static float | anyFloat()Expects any float argument. | |
| static int | anyInt()Expects any int argument. | |
| static long | anyLong()Expects any long argument. | |
| static
 | anyObject()Expects any Object argument. | |
| static short | anyShort()Expects any short argument. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| static
 | 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. | |
| static byte | capture(Capture<java.lang.Byte> captured)Expect any byte but captures it for later use. | |
| static char | capture(Capture<java.lang.Character> captured)Expect any char but captures it for later use. | |
| static double | capture(Capture<java.lang.Double> captured)Expect any double but captures it for later use. | |
| static float | capture(Capture<java.lang.Float> captured)Expect any float but captures it for later use. | |
| static int | capture(Capture<java.lang.Integer> captured)Expect any int but captures it for later use. | |
| static long | capture(Capture<java.lang.Long> captured)Expect any long but captures it for later use. | |
| static
 | capture(Capture<T> captured)Expect any object but captures it for later use. | |
| static void | checkOrder(java.lang.Object mock,
           boolean state)Switches order checking of the given mock object (more exactly: the control of the mock object) the on and off. | |
| static
 | cmp(T value,
    java.util.Comparator<? super T> comparator,
    LogicalOperator operator)Expects an argument that will be compared using the provided comparator. | |
| static
 | cmpEq(java.lang.Comparable<T> value)Expects a comparable argument equals to the given value according to their compareTo method. | |
| static java.lang.String | contains(java.lang.String substring)Expects a string that contains the given substring. | |
| static IMocksControl | createControl()Creates a control, order checking is disabled by default. | |
| static
 | createMock(java.lang.Class<T> toMock)Creates a mock object that implements the given interface, order checking is disabled by default. | |
| static
 | createMock(java.lang.String name,
           java.lang.Class<T> toMock)Creates a mock object that implements the given interface, order checking is disabled by default. | |
| static IMocksControl | createNiceControl()Creates a control, order checking is disabled by default, and the mock objects created by this control will return 0,nullorfalsefor unexpected invocations. | |
| static
 | createNiceMock(java.lang.Class<T> toMock)Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return 0,nullorfalsefor unexpected invocations. | |
| static
 | createNiceMock(java.lang.String name,
               java.lang.Class<T> toMock)Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return 0,nullorfalsefor unexpected invocations. | |
| static IMocksControl | createStrictControl()Creates a control, order checking is enabled by default. | |
| static
 | createStrictMock(java.lang.Class<T> toMock)Creates a mock object that implements the given interface, order checking is enabled by default. | |
| static
 | createStrictMock(java.lang.String name,
                 java.lang.Class<T> toMock)Creates a mock object that implements the given interface, order checking is enabled by default. | |
| static java.lang.String | endsWith(java.lang.String suffix)Expects a string that ends with the given suffix. | |
| static boolean | eq(boolean value)Expects a boolean that is equal to the given value. | |
| static byte | eq(byte value)Expects a byte that is equal to the given value. | |
| static char | eq(char value)Expects a char that is equal to the given value. | |
| static double | eq(double value)Expects a double that is equal to the given value. | |
| 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. | |
| static float | eq(float value)Expects a float that is equal to the given value. | |
| 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. | |
| static int | eq(int value)Expects an int that is equal to the given value. | |
| static long | eq(long value)Expects a long that is equal to the given value. | |
| static short | eq(short value)Expects a short that is equal to the given value. | |
| static
 | eq(T value)Expects an Object that is equal to the given value. | |
| static
 | expect(T value)Returns the expectation setter for the last expected invocation in the current thread. | |
| static
 | expectLastCall()Returns the expectation setter for the last expected invocation in the current thread. | |
| static java.lang.String | find(java.lang.String regex)Expects a string that contains a substring that matches the given regular expression. | |
| static byte | geq(byte value)Expects a byte argument greater than or equal to the given value. | |
| static
 | geq(java.lang.Comparable<T> value)Expects a comparable argument greater than or equal the given value. | |
| static double | geq(double value)Expects a double argument greater than or equal to the given value. | |
| static float | geq(float value)Expects a float argument greater than or equal to the given value. | |
| static int | geq(int value)Expects an int argument greater than or equal to the given value. | |
| static long | geq(long value)Expects a long argument greater than or equal to the given value. | |
| static short | geq(short value)Expects a short argument greater than or equal to the given value. | |
| static java.lang.Object[] | getCurrentArguments()Returns the arguments of the current mock method call, if inside an IAnswercallback - be careful here, reordering parameters of  
 method changes the semantics of your tests. | |
| static byte | gt(byte value)Expects a byte argument greater than the given value. | |
| static
 | gt(java.lang.Comparable<T> value)Expects a comparable argument greater than the given value. | |
| static double | gt(double value)Expects a double argument greater than the given value. | |
| static float | gt(float value)Expects a float argument greater than the given value. | |
| static int | gt(int value)Expects an int argument greater than the given value. | |
| static long | gt(long value)Expects a long argument greater than the given value. | |
| static short | gt(short value)Expects a short argument greater than the given value. | |
| static
 | isA(java.lang.Class<T> clazz)Expects an object implementing the given class. | |
| static
 | isNull()Expects null. | |
| static byte | leq(byte value)Expects a byte argument less than or equal to the given value. | |
| static
 | leq(java.lang.Comparable<T> value)Expects a comparable argument less than or equal the given value. | |
| static double | leq(double value)Expects a double argument less than or equal to the given value. | |
| static float | leq(float value)Expects a float argument less than or equal to the given value. | |
| static int | leq(int value)Expects an int argument less than or equal to the given value. | |
| static long | leq(long value)Expects a long argument less than or equal to the given value. | |
| static short | leq(short value)Expects a short argument less than or equal to the given value. | |
| static byte | lt(byte value)Expects a byte argument less than the given value. | |
| static
 | lt(java.lang.Comparable<T> value)Expects a comparable argument less than the given value. | |
| static double | lt(double value)Expects a double argument less than the given value. | |
| static float | lt(float value)Expects a float argument less than the given value. | |
| static int | lt(int value)Expects an int argument less than the given value. | |
| static long | lt(long value)Expects a long argument less than the given value. | |
| static short | lt(short value)Expects a short argument less than the given value. | |
| static void | makeThreadSafe(java.lang.Object mock,
               boolean threadSafe)Makes the mock thread safe. | |
| static java.lang.String | matches(java.lang.String regex)Expects a string that matches the given regular expression. | |
| static boolean | not(boolean first)Expects a boolean that does not match the given expectation. | |
| static byte | not(byte first)Expects a byte that does not match the given expectation. | |
| static char | not(char first)Expects a char that does not match the given expectation. | |
| static double | not(double first)Expects a double that does not match the given expectation. | |
| static float | not(float first)Expects a float that does not match the given expectation. | |
| static int | not(int first)Expects an int that does not match the given expectation. | |
| static long | not(long first)Expects a long that does not match the given expectation. | |
| static short | not(short first)Expects a short that does not match the given expectation. | |
| static
 | not(T first)Expects an Object that does not match the given expectation. | |
| static
 | notNull()Expects not null. | |
| static boolean | or(boolean first,
   boolean second)Expects a boolean that matches one of the given expectations. | |
| static byte | or(byte first,
   byte second)Expects a byte that matches one of the given expectations. | |
| static char | or(char first,
   char second)Expects a char that matches one of the given expectations. | |
| static double | or(double first,
   double second)Expects a double that matches one of the given expectations. | |
| static float | or(float first,
   float second)Expects a float that matches one of the given expectations. | |
| static int | or(int first,
   int second)Expects an int that matches one of the given expectations. | |
| static long | or(long first,
   long second)Expects a long that matches one of the given expectations. | |
| static short | or(short first,
   short second)Expects a short that matches one of the given expectations. | |
| static
 | or(T first,
   T second)Expects an Object that matches one of the given expectations. | |
| static void | replay(java.lang.Object... mocks)Switches the given mock objects (more exactly: the controls of the mock objects) to replay mode. | |
| static void | reportMatcher(IArgumentMatcher matcher)Reports an argument matcher. | |
| static void | reset(java.lang.Object... mocks)Resets the given mock objects (more exactly: the controls of the mock objects). | |
| static void | resetToDefault(java.lang.Object... mocks)Resets the given mock objects (more exactly: the controls of the mock objects) and turn them to a mock with default behavior. | |
| static void | resetToNice(java.lang.Object... mocks)Resets the given mock objects (more exactly: the controls of the mock objects) and turn them to a mock with nice behavior. | |
| static void | resetToStrict(java.lang.Object... mocks)Resets the given mock objects (more exactly: the controls of the mock objects) and turn them to a mock with strict behavior. | |
| static
 | same(T value)Expects an Object that is the same as the given value. | |
| static java.lang.String | startsWith(java.lang.String prefix)Expects a string that starts with the given prefix. | |
| static void | verify(java.lang.Object... mocks)Verifies the given mock objects (more exactly: the controls of the mock objects). | |
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public EasyMock()
| Method Detail | 
|---|
public static <T> T createStrictMock(java.lang.Class<T> toMock)
T - the interface that the mock object should implement.toMock - the class of the interface that the mock object should
            implement.
public static <T> T createStrictMock(java.lang.String name,
                                     java.lang.Class<T> toMock)
T - the interface that the mock object should implement.name - the name of the mock object.toMock - the class of the interface that the mock object should
            implement.
java.lang.IllegalArgumentException - if the name is not a valid Java identifier.public static <T> T createMock(java.lang.Class<T> toMock)
T - the interface that the mock object should implement.toMock - the class of the interface that the mock object should
            implement.
public static <T> T createMock(java.lang.String name,
                               java.lang.Class<T> toMock)
T - the interface that the mock object should implement.name - the name of the mock object.toMock - the class of the interface that the mock object should
            implement.
java.lang.IllegalArgumentException - if the name is not a valid Java identifier.public static <T> T createNiceMock(java.lang.Class<T> toMock)
0,
 null or false for unexpected invocations.
T - the interface that the mock object should implement.toMock - the class of the interface that the mock object should
            implement.
public static <T> T createNiceMock(java.lang.String name,
                                   java.lang.Class<T> toMock)
0,
 null or false for unexpected invocations.
T - the interface that the mock object should implement.name - the name of the mock object.toMock - the class of the interface that the mock object should
            implement.
java.lang.IllegalArgumentException - if the name is not a valid Java identifier.public static IMocksControl createStrictControl()
public static IMocksControl createControl()
public static IMocksControl createNiceControl()
0,
 null or false for unexpected invocations.
public static <T> IExpectationSetters<T> expect(T value)
value - the parameter is used to transport the type to the
            ExpectationSetter. It allows writing the expected call as
            argument, i.e.
            expect(mock.getName()).andReturn("John Doe").
- Returns:
- the expectation setter.
public static <T> IExpectationSetters<T> expectLastCall()
public static boolean anyBoolean()
false.public static byte anyByte()
0.public static char anyChar()
0.public static int anyInt()
0.public static long anyLong()
0.public static float anyFloat()
0.public static double anyDouble()
0.public static short anyShort()
0.public static <T> T anyObject()
null.public static <T extends java.lang.Comparable<T>> T geq(java.lang.Comparable<T> value)
value - the given value.
null.public static byte geq(byte value)
value - the given value.
0.public static double geq(double value)
value - the given value.
0.public static float geq(float value)
value - the given value.
0.public static int geq(int value)
value - the given value.
0.public static long geq(long value)
value - the given value.
0.public static short geq(short value)
value - the given value.
0.public static <T extends java.lang.Comparable<T>> T leq(java.lang.Comparable<T> value)
value - the given value.
null.public static byte leq(byte value)
value - the given value.
0.public static double leq(double value)
value - the given value.
0.public static float leq(float value)
value - the given value.
0.public static int leq(int value)
value - the given value.
0.public static long leq(long value)
value - the given value.
0.public static short leq(short value)
value - the given value.
0.public static <T extends java.lang.Comparable<T>> T gt(java.lang.Comparable<T> value)
value - the given value.
null.public static byte gt(byte value)
value - the given value.
0.public static double gt(double value)
value - the given value.
0.public static float gt(float value)
value - the given value.
0.public static int gt(int value)
value - the given value.
0.public static long gt(long value)
value - the given value.
0.public static short gt(short value)
value - the given value.
0.public static <T extends java.lang.Comparable<T>> T lt(java.lang.Comparable<T> value)
value - the given value.
null.public static byte lt(byte value)
value - the given value.
0.public static double lt(double value)
value - the given value.
0.public static float lt(float value)
value - the given value.
0.public static int lt(int value)
value - the given value.
0.public static long lt(long value)
value - the given value.
0.public static short lt(short value)
value - the given value.
0.public static <T> T isA(java.lang.Class<T> clazz)
T - the accepted type.clazz - the class of the accepted type.
null.public static java.lang.String contains(java.lang.String substring)
substring - the substring.
null.
public static boolean and(boolean first,
                          boolean second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
false.
public static byte and(byte first,
                       byte second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static char and(char first,
                       char second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static double and(double first,
                         double second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static float and(float first,
                        float second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static int and(int first,
                      int second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static long and(long first,
                       long second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static short and(short first,
                        short second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static <T> T and(T first,
                        T second)
T - the type of the object, it is passed through to prevent casts.first - placeholder for the first expectation.second - placeholder for the second expectation.
null.
public static boolean or(boolean first,
                         boolean second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
false.
public static byte or(byte first,
                      byte second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static char or(char first,
                      char second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static double or(double first,
                        double second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static float or(float first,
                       float second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static int or(int first,
                     int second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static long or(long first,
                      long second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static short or(short first,
                       short second)
first - placeholder for the first expectation.second - placeholder for the second expectation.
0.
public static <T> T or(T first,
                       T second)
T - the type of the object, it is passed through to prevent casts.first - placeholder for the first expectation.second - placeholder for the second expectation.
null.public static boolean not(boolean first)
first - placeholder for the expectation.
false.public static byte not(byte first)
first - placeholder for the expectation.
0.public static char not(char first)
first - placeholder for the expectation.
0.public static double not(double first)
first - placeholder for the expectation.
0.public static float not(float first)
first - placeholder for the expectation.
0.public static int not(int first)
first - placeholder for the expectation.
0.public static long not(long first)
first - placeholder for the expectation.
0.public static short not(short first)
first - placeholder for the expectation.
0.public static <T> T not(T first)
T - the type of the object, it is passed through to prevent casts.first - placeholder for the expectation.
null.public static boolean eq(boolean value)
value - the given value.
0.public static byte eq(byte value)
value - the given value.
0.public static char eq(char value)
value - the given value.
0.public static double eq(double value)
value - the given value.
0.public static float eq(float value)
value - the given value.
0.public static int eq(int value)
value - the given value.
0.public static long eq(long value)
value - the given value.
0.public static short eq(short value)
value - the given value.
0.public static <T> T eq(T value)
value - the given value.
null.public static boolean[] aryEq(boolean[] value)
value - the given arry.
null.public static byte[] aryEq(byte[] value)
value - the given arry.
null.public static char[] aryEq(char[] value)
value - the given arry.
null.public static double[] aryEq(double[] value)
value - the given arry.
null.public static float[] aryEq(float[] value)
value - the given arry.
null.public static int[] aryEq(int[] value)
value - the given arry.
null.public static long[] aryEq(long[] value)
value - the given arry.
null.public static short[] aryEq(short[] value)
value - the given arry.
null.public static <T> T[] aryEq(T[] value)
T - the type of the array, it is passed through to prevent casts.value - the given arry.
null.public static <T> T isNull()
null.public static <T> T notNull()
null.public static java.lang.String find(java.lang.String regex)
regex - the regular expression.
null.public static java.lang.String matches(java.lang.String regex)
regex - the regular expression.
null.public static java.lang.String startsWith(java.lang.String prefix)
prefix - the prefix.
null.public static java.lang.String endsWith(java.lang.String suffix)
suffix - the suffix.
null.
public static double eq(double value,
                        double delta)
value - the given value.delta - the given delta.
0.
public static float eq(float value,
                       float delta)
value - the given value.delta - the given delta.
0.public static <T> T same(T value)
T - the type of the object, it is passed through to prevent casts.value - the given value.
null.public static <T extends java.lang.Comparable<T>> T cmpEq(java.lang.Comparable<T> value)
value - the given value.
null.
public static <T> T cmp(T value,
                        java.util.Comparator<? super T> comparator,
                        LogicalOperator operator)
 comparator.compare(actual, expected) operator 0
 
value - the given value.comparator - Comparator used to compare the actual with expected value.operator - The comparison operator.
nullpublic static <T> T capture(Capture<T> captured)
T - Type of the captured objectcaptured - Where the parameter is captured
nullpublic static int capture(Capture<java.lang.Integer> captured)
captured - Where the parameter is captured
0public static long capture(Capture<java.lang.Long> captured)
captured - Where the parameter is captured
0public static float capture(Capture<java.lang.Float> captured)
captured - Where the parameter is captured
0public static double capture(Capture<java.lang.Double> captured)
captured - Where the parameter is captured
0public static byte capture(Capture<java.lang.Byte> captured)
captured - Where the parameter is captured
0public static char capture(Capture<java.lang.Character> captured)
captured - Where the parameter is captured
0public static void replay(java.lang.Object... mocks)
mocks - the mock objects.public static void reset(java.lang.Object... mocks)
mocks - the mock objects.public static void resetToNice(java.lang.Object... mocks)
mocks - the mock objectspublic static void resetToDefault(java.lang.Object... mocks)
mocks - the mock objectspublic static void resetToStrict(java.lang.Object... mocks)
mocks - the mock objectspublic static void verify(java.lang.Object... mocks)
mocks - the mock objects.
public static void checkOrder(java.lang.Object mock,
                              boolean state)
mock - the mock object.state - true switches order checking on,
            false switches it off.public static void reportMatcher(IArgumentMatcher matcher)
matcher - public static java.lang.Object[] getCurrentArguments()
IAnswer callback - be careful here, reordering parameters of  
 method changes the semantics of your tests.
java.lang.IllegalStateException - if called outside of IAnswer callbacks.
public static void makeThreadSafe(java.lang.Object mock,
                                  boolean threadSafe)
mock - the mock to make thread safethreadSafe - If the mock should be thread safe or not| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||