@Test
 public void testInvokeUndefinedStaticMethod() {
   try {
     StatementBuilder.create().invokeStatic(Integer.class, "intValue").toJavaString();
     fail("expected UndefinedMethodException");
   } catch (UndefinedMethodException udme) {
     assertEquals("Wrong exception details", udme.getMethodName(), "intValue");
   }
 }
 @Test
 public void testInvokeUndefinedMethodOnVariable() {
   try {
     StatementBuilder.create()
         .declareVariable("obj", Object.class)
         .declareVariable("param", String.class)
         .loadVariable("obj")
         .invoke("undefinedMethod", Variable.get("param"))
         .toJavaString();
     fail("expected UndefinedMethodException");
   } catch (UndefinedMethodException udme) {
     // expected
     assertEquals("Wrong exception thrown", udme.getMethodName(), "undefinedMethod");
   }
 }
 @Test
 public void testInvokeChainedUndefinedMethod() {
   try {
     StatementBuilder.create()
         .declareVariable("s", String.class)
         .declareVariable("regex", String.class)
         .declareVariable("replacement", String.class)
         .loadVariable("s")
         .invoke("replaceAll", Variable.get("regex"), Variable.get("replacement"))
         .invoke("undefinedMethod", Variable.get("regex"), Variable.get("replacement"))
         .toJavaString();
     fail("expected UndefinedMethodException");
   } catch (UndefinedMethodException udme) {
     // expected
     assertEquals("Wrong exception thrown", udme.getMethodName(), "undefinedMethod");
   }
 }