Package net.tirasa.connid.commons.db
Class ExpectProxy<T>
java.lang.Object
net.tirasa.connid.commons.db.ExpectProxy<T>
- Type Parameters:
T
- Type of the interface for testing
- All Implemented Interfaces:
InvocationHandler
This is a Test helper class for testing expected method calls and return values of interfaces
Limitation:
First implementation supports just a method name checking
- Since:
- 1.0
- Version:
- $Revision 1.0$
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionProgram the expected method callexpectAndReturn
(String methodName, Object retVal) Program the expected function callexpectAndThrow
(String methodName, Throwable throwEx) Program the expected method callReturn the Proxy implementation of the Interfaceboolean
isDone()
Test that all expected was called in the order
-
Constructor Details
-
ExpectProxy
public ExpectProxy()
-
-
Method Details
-
expectAndReturn
Program the expected function call- Parameters:
methodName
- the expected method nameretVal
- the expected return value or proxy- Returns:
- the proxy
-
expect
Program the expected method call- Parameters:
methodName
- the expected method name- Returns:
- the proxy
-
expectAndThrow
Program the expected method call- Parameters:
methodName
- the expected method namethrowEx
- the expected exception- Returns:
- the proxy
-
isDone
public boolean isDone()Test that all expected was called in the order- Returns:
- true/false all was called
-
invoke
- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-
getProxy
Return the Proxy implementation of the Interface- Parameters:
clazz
- of the interface- Returns:
- the proxy
-