Ejemplo n.º 1
0
  /** Tests the {@link org.jruby.runtime.profile.ProfilingServiceLookup} too */
  public void testProfilingServiceLookupWorks() {
    try {
      RubyInstanceConfig config = Ruby.getGlobalRuntime().getInstanceConfig();

      RubyInstanceConfig configOne = new RubyInstanceConfig(config);

      configOne.setProfilingService(TestProfilingService.class.getName());
      configOne.setProfilingMode(RubyInstanceConfig.ProfilingMode.SERVICE);
      Ruby ruby = Ruby.newInstance(configOne);

      assertNotNull(ruby.getProfilingService());
      assertTrue(ruby.getProfilingService() instanceof TestProfilingService);
    } catch (RaiseException e) {
      // e.printStackTrace();
      // TODO hwo to mock org.jruby.exceptions.RaiseException: (LoadError) no such file to load --
      // jruby/profiler/shutdown_hook
    }
  }