### Question:
AbstractHandlerFactory implements HandlerFactory { @Override public InvokeHandler getInvocationHandler(int messageType, RpcRole rpcRole) { if (Constants.MESSAGE_TYPE_HEART == messageType) { if (heartBeatInvokeHandler == null) { heartBeatInvokeHandler = createHeartBeatInvocationHandler(); } return heartBeatInvokeHandler; } else if (Constants.MESSAGE_TYPE_SERVICE == messageType) { InvokeHandler serviceInvokeHandler = serviceInvokeHandlers.get(rpcRole); if (serviceInvokeHandler == null) { synchronized (HandlerFactory.class) { if (serviceInvokeHandler == null) { serviceInvokeHandler = createServiceInvocationHandler(rpcRole); serviceInvokeHandlers.putIfAbsent(rpcRole, serviceInvokeHandler); } } serviceInvokeHandler = serviceInvokeHandlers.get(rpcRole); } return serviceInvokeHandler; } else { return getOtherInvocationHandler(messageType, rpcRole); } }  @Override InvokeHandler getInvocationHandler(int messageType, RpcRole rpcRole);  }### Answer:
@Test public void test() { MockHandlerFactory factory = new MockHandlerFactory(); try { factory.getInvocationHandler(Constants.MESSAGE_TYPE_HEART, RpcRole.INVOKER); } catch(Exception e) { Assert.assertTrue(e instanceof RuntimeException); Assert.assertTrue(e.getMessage().contains("No implement of")); } try { factory.getInvocationHandler(Constants.MESSAGE_TYPE_SERVICE, RpcRole.INVOKER); } catch(Exception e) { Assert.assertTrue(e instanceof IllegalStateException); Assert.assertTrue(e.getMessage().contains("Can not found InvokeHandler with role")); } }