|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| InvocationHandler.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 | package com.agical.rmock.core; | |
| 2 | ||
| 3 | import com.agical.rmock.core.exception.UnsatisfiedDependencySystemException; | |
| 4 | ||
| 5 | /** | |
| 6 | * An invocation handler handles invocations from mocks or intercepted objects. | |
| 7 | * An invocation handler typically records or veifies expectations but could also | |
| 8 | * do other things such as logging them. | |
| 9 | * <br/> | |
| 10 | * <br/> | |
| 11 | * <em>(c) Agical AB 2005</em> | |
| 12 | * @author joakim.ohlrogge | |
| 13 | */ | |
| 14 | public interface InvocationHandler { | |
| 15 | ||
| 16 | InvocationHandler NULL = new InvocationHandler() { | |
| 17 | ||
| 18 | 1 | public Object invocation(String id, Class objectType, String method, Object[] arguments, MethodHandle methodHandle) throws Throwable { |
| 19 | 1 | throw new UnsatisfiedDependencySystemException(InvocationHandler.class); |
| 20 | } | |
| 21 | ||
| 22 | }; | |
| 23 | ||
| 24 | /** | |
| 25 | * Called when an invocation is made to a mock. An invocation handler typically records or verifies the | |
| 26 | * invication. | |
| 27 | * @param id The id of the mock that made the invocation | |
| 28 | * @param objectType The type of the object that received the method invocation | |
| 29 | * @param method The method that was invoked | |
| 30 | * @param methodHandle A callback to the original method on the receiving object. | |
| 31 | * @param the arguments that was passed to the invoked method | |
| 32 | * @throws any throwable that might be thrown | |
| 33 | * @return The result of the invocation | |
| 34 | */ | |
| 35 | Object invocation(String id, Class objectType, String method, Object[] arguments, MethodHandle methodHandle) throws Throwable; | |
| 36 | } |
|
||||||||||