KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jruby > test > MockRubyObject


1 package org.jruby.test;
2
3 import org.jruby.Ruby;
4 import org.jruby.RubyClass;
5 import org.jruby.RubyObject;
6 import org.jruby.runtime.Block;
7 import org.jruby.runtime.builtin.IRubyObject;
8
9 public class MockRubyObject extends RubyObject {
10
11     private final Ruby runtime;
12
13     private static class TestMeta extends RubyClass {
14
15         protected TestMeta(Ruby runtime) {
16             // This null doesn't feel right
17
super(runtime, runtime.getObject(), null);
18         }
19     }
20     
21     public MockRubyObject(Ruby runtime) {
22         super(runtime, new TestMeta(runtime));
23         this.runtime = runtime;
24     }
25     
26     public Ruby getRuntime() {
27         return runtime;
28     }
29     
30     public static void throwException(IRubyObject recv, Block block) {
31         throw new RuntimeException JavaDoc("x");
32     }
33
34 }
35
Popular Tags