Feign { public static String configKey(Class targetType, Method method) { StringBuilder builder = new StringBuilder(); builder.append(targetType.getSimpleName()); builder.append('#').append(method.getName()).append('('); for (Type param : method.getGenericParameterTypes()) { param = Types.resolve(targetType, targetType, param); builder.append(Types.getRawType(param).getSimpleName()).append(','); } if (method.getParameterTypes().length > 0) { builder.deleteCharAt(builder.length() - 1); } return builder.append(')').toString(); }  static Builder builder(); static String configKey(Class targetType, Method method); @Deprecated static String configKey(Method method); abstract T newInstance(Target<T> target);  }
@Test public void configKeyFormatsAsExpected() throws Exception { assertEquals("TestInterface#post()", Feign.configKey(TestInterface.class, TestInterface.class.getDeclaredMethod("post"))); assertEquals("TestInterface#uriParam(String,URI,String)", Feign.configKey(TestInterface.class, TestInterface.class .getDeclaredMethod("uriParam", String.class, URI.class, String.class))); }
@Test public void configKeyUsesChildType() throws Exception { assertEquals("List#iterator()", Feign.configKey(List.class, Iterable.class.getDeclaredMethod("iterator"))); }