MethodSignatureFormatter extends Formatter<ExecutableElement> { @Override public String format(ExecutableElement method) { return format(method, Optional.<DeclaredType>absent()); } MethodSignatureFormatter(Types types); @Override String format(ExecutableElement method); String format(ExecutableElement method, Optional<DeclaredType> container);  }
@Test public void methodSignatureTest() { Elements elements = compilationRule.getElements(); TypeElement inner = elements.getTypeElement(InnerClass.class.getCanonicalName()); ExecutableElement method = Iterables.getOnlyElement(methodsIn(inner.getEnclosedElements())); String formatted = new MethodSignatureFormatter(compilationRule.getTypes()).format(method); assertThat(formatted).contains("@Singleton"); assertThat(formatted).doesNotContain("@javax.inject.Singleton"); assertThat(formatted) .contains("@dagger.internal.codegen.MethodSignatureFormatterTest.OuterClass.Foo" + "(bar=String.class)"); assertThat(formatted).contains(" String "); assertThat(formatted).contains("int, ImmutableList<Boolean>)"); }