DefaultSetterFactory implements SetterFactory { public static String generateCommandKey(String interfaceId, Method method) { StringBuilder builder = new StringBuilder(interfaceId) .append("#") .append(method.getName()) .append("("); if (method.getParameterTypes().length > 0) { for (Class<?> parameterType : method.getParameterTypes()) { builder.append(parameterType.getSimpleName()).append(","); } builder.deleteCharAt(builder.length() - 1); } return builder.append(")").toString(); }  @Override HystrixCommand.Setter createSetter(FilterInvoker invoker, SofaRequest request); static String generateCommandKey(String interfaceId, Method method);  }
@Test public void testGenerateCommandKey() { for (Method method : TestCase.class.getMethods()) { if (method.isAnnotationPresent(HystrixCommandKey.class)) { HystrixCommandKey annotation = method.getAnnotation(HystrixCommandKey.class); Assert.assertEquals(annotation.value(), DefaultSetterFactory.generateCommandKey("TestCase", method)); } } }