AbstractDataServiceVisitor implements ElementVisitor<String, Writer> ,ProcessorConstants { List<String> getArguments(ExecutableElement methodElement) { List<String> res = new ArrayList<>(); for (VariableElement variableElement : methodElement.getParameters()) { res.add(variableElement.toString()); } return res; } AbstractDataServiceVisitor(ProcessingEnvironment environment); @Override String visitType(TypeElement typeElement, Writer writer); @Override String visit(Element e, Writer p); @Override String visit(Element e); @Override String visitPackage(PackageElement e, Writer p); @Override String visitVariable(VariableElement e, Writer p); @Override String visitExecutable(ExecutableElement e, Writer p); @Override String visitTypeParameter(TypeParameterElement e, Writer p); @Override String visitUnknown(Element e, Writer p);  }
@Test public void testGetArguments() { System.out.println("getArguments"); ExecutableElement methodElement = mock(ExecutableElement.class); VariableElement var0 = mock(VariableElement.class); VariableElement var1 = mock(VariableElement.class); List ves = Arrays.asList(var0, var1); when(var0.toString()).thenReturn("a"); when(var1.toString()).thenReturn("b"); when(methodElement.getParameters()).thenReturn(ves); List<String> expResult = Arrays.asList("a", "b"); List<String> result = instance.getArguments(methodElement); assertThat(result).isEqualTo(expResult); }