List of usage examples for javax.management RuntimeMBeanException RuntimeMBeanException
public RuntimeMBeanException(java.lang.RuntimeException e)
RuntimeMBeanException
that wraps the actual java.lang.RuntimeException
. From source file:org.jolokia.http.HttpRequestHandlerTest.java
@Test public void requestErrorHandling() throws MalformedObjectNameException, InstanceNotFoundException, IOException, ReflectionException, AttributeNotFoundException, MBeanException { Object[] exceptions = new Object[] { new ReflectionException(new NullPointerException()), 404, 500, new InstanceNotFoundException(), 404, 500, new MBeanException(new NullPointerException()), 500, 500, new AttributeNotFoundException(), 404, 500, new UnsupportedOperationException(), 500, 500, new IOException(), 500, 500, new IllegalArgumentException(), 400, 400, new SecurityException(), 403, 403, new RuntimeMBeanException(new NullPointerException()), 500, 500 }; for (int i = 0; i < exceptions.length; i += 3) { Exception e = (Exception) exceptions[i]; reset(backend);//from ww w . ja va 2 s. c om expect(backend.isDebug()).andReturn(true).anyTimes(); backend.error(find("" + exceptions[i + 1]), EasyMock.<Throwable>anyObject()); backend.error(find("" + exceptions[i + 2]), EasyMock.<Throwable>anyObject()); expect(backend.handleRequest(EasyMock.<JmxRequest>anyObject())).andThrow(e); replay(backend); JSONObject resp = (JSONObject) handler.handleGetRequest("/jolokia", "/read/java.lang:type=Memory/HeapMemoryUsage", null); assertEquals(resp.get("status"), exceptions[i + 1]); resp = handler.handleThrowable(e); assertEquals(resp.get("status"), exceptions[i + 2], e.getClass().getName()); } }