DataServiceVisitorJsBuilder extends AbstractDataServiceVisitor { void writeArguments(Iterator<String> names, Writer writer) throws IOException { while(names.hasNext()) { String name = names.next(); writer.append(name); if(names.hasNext()) { writer.append(COMMA).append(SPACEOPTIONAL); } } } DataServiceVisitorJsBuilder(ProcessingEnvironment environment, FwkWriter fwk);   }
@Test public void writeArgumentsTest() throws IOException { System.out.println("writeArguments"); Writer writer; List<String> arguments; arguments = new ArrayList<>(); writer = new StringWriter(); instance.writeArguments(arguments.iterator(), writer); assertThat(writer.toString()).isEmpty(); arguments = Arrays.asList("a"); writer = new StringWriter(); instance.writeArguments(arguments.iterator(), writer); assertThat(writer.toString()).isEqualTo("a"); arguments = Arrays.asList("a", "b"); writer = new StringWriter(); instance.writeArguments(arguments.iterator(), writer); assertThat(writer.toString()).isEqualTo("a,"+SPACEOPTIONAL+"b"); arguments = Arrays.asList("a", "b", "c"); writer = new StringWriter(); instance.writeArguments(arguments.iterator(), writer); assertThat(writer.toString()).isEqualTo("a,"+SPACEOPTIONAL+"b,"+SPACEOPTIONAL+"c"); }