@Test public void testRestHandler_serviceDoesntExist() { RestHandler restHandler = registry.getRestHandler("/makebelieve", "GET"); try { Future<?> future = restHandler.execute(Maps.<String, String[]>newHashMap(), null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testRestHandler_serviceDoesntExist() { RestHandler restHandler = registry.getRestHandler("/makebelieve", "GET"); try { Future<?> future = restHandler.execute(Maps.<String, String[]>newHashMap(), null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testRestHandler_serviceDoesntExist() { RestHandler restHandler = registry.getRestHandler("/makebelieve", "GET"); try { Future<?> future = restHandler.execute(Maps.<String, String[]>newHashMap(), null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.futureException }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce ExecutionException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), ProtocolException.class); } }
@Test public void testNonFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.exception }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce NullPointerException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), NullPointerException.class); } }
@Test public void testRestHandler_serviceDoesntExist() { RestHandler restHandler = registry.getRestHandler("/makebelieve", "GET"); try { Future<?> future = restHandler.execute(Maps.<String, String[]>newHashMap(), null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testRestHandler_serviceDoesntExist() { RestHandler restHandler = registry.getRestHandler("/makebelieve", "GET"); try { Future<?> future = restHandler.execute(Maps.<String, String[]>newHashMap(), null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testNonFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.exception }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce NullPointerException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), NullPointerException.class); } }
@Test public void testFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.futureException }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce ExecutionException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), ProtocolException.class); } }
@Test public void testFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.futureException }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce ExecutionException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), ProtocolException.class); } }
@Test public void testRpcHandler_serviceDoesntExist() throws Exception { JSONObject rpc = new JSONObject("{method : makebelieve.get}"); RpcHandler rpcHandler = registry.getRpcHandler(rpc); try { Future<?> future = rpcHandler.execute(null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testRpcHandler_serviceDoesntExist() throws Exception { JSONObject rpc = new JSONObject("{method : makebelieve.get}"); RpcHandler rpcHandler = registry.getRpcHandler(rpc); try { Future<?> future = rpcHandler.execute(null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testRpcHandler_serviceDoesntExist() throws Exception { JSONObject rpc = new JSONObject("{method : makebelieve.get}"); RpcHandler rpcHandler = registry.getRpcHandler(rpc); try { Future<?> future = rpcHandler.execute(null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testNonFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.exception }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce NullPointerException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), NullPointerException.class); } }
@Test public void testFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.futureException }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce ExecutionException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), ProtocolException.class); } }
@Test public void testRpcHandler_serviceDoesntExist() throws Exception { JSONObject rpc = new JSONObject("{method : makebelieve.get}"); RpcHandler rpcHandler = registry.getRpcHandler(rpc); try { Future<?> future = rpcHandler.execute(null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.futureException }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce ExecutionException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), ProtocolException.class); } }
@Test public void testNonFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.exception }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce NullPointerException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), NullPointerException.class); } }
@Test public void testRpcHandler_serviceDoesntExist() throws Exception { JSONObject rpc = new JSONObject("{method : makebelieve.get}"); RpcHandler rpcHandler = registry.getRpcHandler(rpc); try { Future<?> future = rpcHandler.execute(null, null, null); future.get(); fail("Expect exception for missing method"); } catch (ExecutionException t) { assertSame(t.getCause().getClass(), ProtocolException.class); Assert.assertEquals(HttpServletResponse.SC_NOT_IMPLEMENTED, ((ProtocolException) t.getCause()).getCode()); } catch (Throwable t) { fail("Unexpected exception " + t.toString()); } }
@Test public void testNonFutureException() throws Exception { // Test calling a handler method which does not return a future JSONObject rpc = new JSONObject("{ method : test.exception }"); RpcHandler handler = registry.getRpcHandler(rpc); Future<?> future = handler.execute(null, null, null); try { future.get(); fail("Service method did not produce NullPointerException from Future"); } catch (ExecutionException ee) { assertSame(ee.getCause().getClass(), NullPointerException.class); } }