private Object getDefaultValue(final Class<?> type) { if (type.equals(V8Object.class)) { return new V8Object.Undefined(); } else if (type.equals(V8Array.class)) { return new V8Array.Undefined(); } return invalid; }
private Object getDefaultValue(final Class<?> type) { if (type.equals(V8Object.class)) { return new V8Object.Undefined(); } else if (type.equals(V8Array.class)) { return new V8Array.Undefined(); } return invalid; }
private Object getDefaultValue(final Class<?> type) { if (type.equals(V8Object.class)) { return new V8Object.Undefined(); } else if (type.equals(V8Array.class)) { return new V8Array.Undefined(); } return invalid; }
@Test public void testVoidMethodCallWithMissingObjectArgs() { ICallback callback = mock(ICallback.class); v8.registerJavaMethod(callback, "voidMethodWithObjectParameter", "foo", new Class<?>[] { V8Object.class }); v8.executeVoidScript("foo()"); verify(callback).voidMethodWithObjectParameter(new V8Array.Undefined()); }
@Test public void testV8ArrayMethodReturnsUndefined() { ICallback callback = mock(ICallback.class); doReturn(new V8Array.Undefined()).when(callback).v8ArrayMethodNoParameters(); v8.registerJavaMethod(callback, "v8ArrayMethodNoParameters", "foo", new Class<?>[0]); boolean result = v8.executeBooleanScript("typeof foo() === 'undefined'"); assertTrue(result); }
private Object getDefaultValue(final Class<?> type) { if (type.equals(V8Object.class)) { return new V8Object.Undefined(); } else if (type.equals(V8Array.class)) { return new V8Array.Undefined(); } return invalid; }
@SuppressWarnings("resource") @Test public void testObjectUndefinedHashCodeEqualsArrayUndefinedHashCode() { assertEquals(new V8Object.Undefined().hashCode(), new V8Array.Undefined().hashCode()); }
@SuppressWarnings("resource") @Test public void testObjectUndefinedEqualsArrayUndefined() { assertEquals(new V8Object.Undefined(), new V8Array.Undefined()); }
@Test public void testUndefinedNotReleased() { com.eclipsesource.v8.V8Array.Undefined undefined = new V8Array.Undefined(); undefined.close(); assertFalse(undefined.isReleased()); }