JsCacheRemoveVisitor implements ElementVisitor<Void, Writer> { void appendParameters(List<? extends VariableElement> elements, Writer p) throws IOException { boolean first = true; for (VariableElement variableElement : elements) { if (!first) { p.append(","); } p.append(variableElement.toString()); first = false; } } 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 appendParametersTest() throws IOException { System.out.println("appendParameters"); Writer writer; VariableElement ve = mock(VariableElement.class); when(ve.toString()).thenReturn("arg"); writer = new StringWriter(); instance.appendParameters(Arrays.asList(ve), writer); assertThat(writer.toString()).isEqualTo("arg"); writer = new StringWriter(); instance.appendParameters(Arrays.asList(ve, ve), writer); assertThat(writer.toString()).isEqualTo("arg,arg"); writer = new StringWriter(); instance.appendParameters(Arrays.asList(ve, ve, ve), writer); assertThat(writer.toString()).isEqualTo("arg,arg,arg"); }