use of com.android.tools.idea.gradle.util.ProxyUtil.WrapperInvocationHandler in project android by JetBrains.
the class ProxyUtilTest method testNewMethod.
public void testNewMethod() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
MyInterface reproxy = reproxy(MyInterface.class, myProxy);
assertNotNull(reproxy);
InvocationHandler handler = Proxy.getInvocationHandler(reproxy);
assertTrue(handler instanceof WrapperInvocationHandler);
WrapperInvocationHandler wrapper = (WrapperInvocationHandler) handler;
Method m = MyInterface.class.getMethod("getString");
wrapper.values.remove(m.toGenericString());
try {
reproxy.getString();
fail("Removed method should throw an exception");
} catch (UnsupportedMethodException e) {
// Expected.
}
}
use of com.android.tools.idea.gradle.util.ProxyUtil.WrapperInvocationHandler in project android by JetBrains.
the class ProxyUtilTest method testValidityNegative.
public void testValidityNegative() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
MyInterface reproxy = reproxy(MyInterface.class, myProxy);
assertNotNull(reproxy);
InvocationHandler handler = Proxy.getInvocationHandler(reproxy);
assertTrue(handler instanceof WrapperInvocationHandler);
WrapperInvocationHandler wrapper = (WrapperInvocationHandler) handler;
Method m = MyInterface.class.getMethod("getString");
wrapper.values.remove(m.toGenericString());
// Removed method should result in validity check failure
assertFalse(isValidProxyObject(reproxy));
}
Aggregations