YarProtocolUtil { public static String getYarPath(Class<?> interfaceClazz, URL url) { if (interfaceClazz != null) { YarConfig config = interfaceClazz.getAnnotation(YarConfig.class); if (config != null && StringUtils.isNotBlank(config.path())) { return config.path(); } } return "/" + url.getGroup() + "/" + url.getPath(); }  static String getYarPath(Class<?> interfaceClazz, URL url); static Request convert(YarRequest yarRequest, Class<?> interfaceClass); static YarRequest convert(Request request, String packagerName); static Response convert(YarResponse yarResponse); static YarResponse convert(Response response, String packagerName); static YarResponse buildDefaultErrorResponse(String errMsg, String packagerName);  }
@Test public void testGetYarPath() { String path = YarProtocolUtil.getYarPath(YarMessageRouterTest.AnnoService.class, null); assertEquals("/test/anno_path", path); URL url = new URL("motan", "localhost", 8002, "testpath"); path = YarProtocolUtil.getYarPath(null, url); assertEquals("/" + url.getGroup() + "/" + url.getPath(), path); }