use of org.graalvm.polyglot.proxy.ProxyInstantiable in project graal by oracle.
the class ProxySPITest method testProxyInstantiable.
@Test
public void testProxyInstantiable() throws Throwable {
Context context = Context.create();
ProxyInstantiable proxyOuter = new ProxyInstantiable() {
@Override
public Object newInstance(Value... t) {
return t[0].newInstance();
}
};
eval(context, proxyOuter, (proxyInner) -> {
assertEquals(true, Message.IS_INSTANTIABLE, proxyInner);
assertEquals(false, Message.IS_EXECUTABLE, proxyInner);
assertUnsupported(Message.createExecute(0), proxyInner, 42);
assertUnsupported(Message.AS_POINTER, proxyInner);
assertUnsupported(Message.GET_SIZE, proxyInner);
assertEmpty(Message.KEYS, proxyInner);
assertUnsupported(Message.READ, proxyInner);
assertUnsupported(Message.WRITE, proxyInner);
assertUnsupported(Message.TO_NATIVE, proxyInner);
assertUnsupported(Message.UNBOX, proxyInner);
assertUnsupported(Message.createInvoke(0), proxyInner);
assertEquals(false, Message.IS_BOXED, proxyInner);
assertEquals(false, Message.IS_NULL, proxyInner);
assertEquals(false, Message.HAS_KEYS, proxyInner);
assertEquals(false, Message.HAS_SIZE, proxyInner);
assertEquals(false, Message.IS_POINTER, proxyInner);
assertEquals(0, Message.KEY_INFO, proxyInner);
return null;
});
}
Aggregations