package white.box.tester.generators;

import com.beust.jcommander.Parameter;
import white.box.tester.model.GroupData;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Max on 10/17/2016.
 */
public class GroupDataGenerator {

  @Parameter(names = "-c" description = "Group count")
  public int count;

  @Parameter
  public String file;

  public static void main(String[] args) throws IOException {
    int count = Integer.parseInt(args[0]);
    File file = new File(args[1]);

    List<GroupData> groups = generateGroups(count);
    save(groups, file);
    }

  private static void save(List<GroupData> groups, File file) throws IOException {

    Writer writer = new FileWriter(file);
    for (GroupData group : groups) {
      writer.write(String.format("%s;%s;%s;\n", group.getName(), group.getHeader(),
              group.getFooter()));
    }
  writer.close();
  }

  private static List<GroupData> generateGroups(int count) {
   List<GroupData> groups = new ArrayList<GroupData>();
    for (int i = 0; i < count; i++) {
      groups.add(new GroupData().withName(String.format("test %s", i))
              .withHeader(String.format("header %s", i))
              .withFooter(String.format("footer %s", i)));
    }

    return groups;
  }

}


@@ -59,25 +59,113 @@
 mmander.
-Parameter
+JCommander;%0Aimport com.beust.jcommander.Parameter;%0Aimport com.beust.jcommander.ParameterException
 ;%0Aimport
@@ -452,16 +452,17 @@
 s = %22-c%22
+,
  descrip
@@ -516,16 +516,60 @@
 arameter
+ (names = %22-f%22, description = %22Target file%22)
 %0A  publi
@@ -584,16 +584,17 @@
  file;%0A%0A
+%0A
   public
@@ -655,33 +655,152 @@
     
-int count = Integ
+GroupDataGenerator generator = new GroupDataGenerator();%0A    JCommander jCommander = new JCommander(generator);%0A    try %7B%0A      JCommand
 er.parse
 Int(
@@ -799,57 +799,169 @@
 arse
-Int
 (args
-%5B0%5D
 );%0A    
-File file = new File(args%5B1%5D);%0A
+%7D catch (ParameterException ex) %7B%0A      jCommander.usage();%0A      return;%0A    %7D%0A    generator.run();%0A    %7D%0A%0A  private void run() throws IOException %7B
 %0A   
@@ -1026,25 +1026,33 @@
 groups, 
+new File(
 file)
+)
 ;%0A
-  
   %7D%0A%0A  p
@@ -1058,23 +1058,16 @@
 private 
-static 
 void sav
@@ -1362,23 +1362,16 @@
 private 
-static 
 List%3CGro
@@ -1693,17 +1693,16 @@
 ;%0A    %7D%0A
-%0A
     retu

Update 6.3