Handler { public Object invoke(Map<String, Object> parameters) throws Exception { Object[] params = new Object[parameterOrder.size()]; for (int x = 0; x < parameterOrder.size(); ++x) { String parameterName = parameterOrder.get(x); params[x] = parameters.get(parameterName); } try { return method.invoke(webService, params); } catch (InvocationTargetException e) { throw Throwables.propagate(e.getCause()); } } Handler(Object webService, Method method); Map<String, Type> getParameterNameToType(); Object invoke(Map<String, Object> parameters);  }
@Test public void invokeWithException() throws Exception { Handler handler = new Handler(new TestWebService(), TestWebService.class.getDeclaredMethod("thrower")); thrown.expect(RuntimeException.class); thrown.expectMessage("ouch"); handler.invoke(ImmutableMap.of()); }
@Test public void invokeWithParameter() throws Exception { Handler handler = new Handler(new TestWebService(), TestWebService.class.getDeclaredMethod("echo", String.class)); assertEquals("test it yeah!", handler.invoke(ImmutableMap.of("message", "test it yeah!"))); }