< prev index next >

test/valhalla/mvt/MethodHandlesTest.java

Print this page

        

@@ -72,6 +72,17 @@
         {
             MethodHandle mh = MethodHandles.insertArguments(VCC_MH, 0, new Object[]{null});
             assertThrows(NullPointerException.class, () -> mh.invokeWithArguments());
         }
     }
+
+    @Test
+    void testConstantDVT() throws Throwable {
+        assertEquals(MethodHandles.constant(DVT, ARG).invokeWithArguments(), ARG);
+
+        assertThrows(ClassCastException.class,
+                () -> MethodHandles.constant(DVT, new Object()));
+
+        assertThrows(NullPointerException.class,
+                () -> MethodHandles.constant(DVT, null));
+    }
 }
< prev index next >