|
| 1 | +package com.getcapacitor; |
| 2 | + |
| 3 | +import org.junit.Test; |
| 4 | + |
| 5 | +import java.lang.reflect.Method; |
| 6 | + |
| 7 | +import static org.junit.Assert.assertEquals; |
| 8 | +import static org.mockito.BDDMockito.given; |
| 9 | +import static org.mockito.Mockito.mock; |
| 10 | + |
| 11 | +public class PluginMethodHandleTest { |
| 12 | + @Test |
| 13 | + public void getNameReturnsMethodName() { |
| 14 | + PluginMethod pluginMethod = mock(PluginMethod.class); |
| 15 | + Method mockMethod = mock(Method.class); |
| 16 | + |
| 17 | + given(mockMethod.getName()).willReturn("methodName"); |
| 18 | + PluginMethodHandle pluginMethodHandle = new PluginMethodHandle(mockMethod, pluginMethod); |
| 19 | + |
| 20 | + assertEquals(pluginMethodHandle.getName(), "methodName"); |
| 21 | + } |
| 22 | + |
| 23 | + @Test |
| 24 | + public void getMethodHandleReturnsMethodHandle() { |
| 25 | + PluginMethod pluginMethod = mock(PluginMethod.class); |
| 26 | + Method mockMethod = mock(Method.class); |
| 27 | + |
| 28 | + given(pluginMethod.returnType()).willReturn("returnType"); |
| 29 | + PluginMethodHandle pluginMethodHandle = new PluginMethodHandle(mockMethod, pluginMethod); |
| 30 | + |
| 31 | + assertEquals(pluginMethodHandle.getReturnType(), "returnType"); |
| 32 | + } |
| 33 | + |
| 34 | + |
| 35 | + @Test |
| 36 | + public void getMethodReturnsMethod() { |
| 37 | + PluginMethod pluginMethod = mock(PluginMethod.class); |
| 38 | + Method mockMethod = mock(Method.class); |
| 39 | + |
| 40 | + PluginMethodHandle pluginMethodHandle = new PluginMethodHandle(mockMethod, pluginMethod); |
| 41 | + |
| 42 | + assertEquals(pluginMethodHandle.getMethod(), mockMethod); |
| 43 | + } |
| 44 | +} |
0 commit comments