JsCacheRemoveVisitor implements ElementVisitor<Void, Writer> { @Override public Void visitExecutable(ExecutableElement e, Writer p) { try { p.append(e.getEnclosingElement().toString()).append(".").append(e.getSimpleName()).append("="); appendParameters(e.getParameters(), p); p.append("\n"); } catch (IOException ex) { } return null; } JsCacheRemoveVisitor(ProcessingEnvironment environment); @Override Void visit(Element e, Writer p); @Override Void visit(Element e); @Override Void visitPackage(PackageElement e, Writer p); @Override Void visitType(TypeElement e, Writer p); @Override Void visitVariable(VariableElement e, Writer p); @Override Void visitExecutable(ExecutableElement e, Writer p); @Override Void visitTypeParameter(TypeParameterElement e, Writer p); @Override Void visitUnknown(Element e, Writer p);  }
@Test public void testVisitExecutable() throws IOException { System.out.println("visitExecutable"); Writer writer; ExecutableElement exElt = mock(ExecutableElement.class); Name name = mock(Name.class); when(name.toString()).thenReturn("methodName"); when(exElt.getSimpleName()).thenReturn(name); TypeElement te = mock(TypeElement.class); when(te.toString()).thenReturn("package.ClassName"); when(exElt.getEnclosingElement()).thenReturn(te); doNothing().doThrow(IOException.class).when(instance).appendParameters(anyList(), any(Writer.class)); writer = new StringWriter(); instance.visitExecutable(exElt, writer); assertThat(writer.toString()).isEqualTo("package.ClassName.methodName=\n"); writer = new StringWriter(); instance.visitExecutable(exElt, writer); assertThat(writer.toString()).isEqualTo("package.ClassName.methodName="); }