package com.example.tests;

import java.util.Collections;
import java.util.List;

import static org.testng.Assert.assertEquals;

import org.testng.annotations.Test;

public class GroupCreationTests extends TestBase {
  @Test
  public void testNonEmptyGroupCreation() throws Exception {
    app.getNavigationHelper().openMainPage();
    app.getGroupHelper().gotoGroupsPage();
    
    //save old state
    List<GroupData> oldList = app.getGroupHelper().getGroups();
    
    //actions
    app.getGroupHelper().initGroupCreation();
    GroupData group = new GroupData();
	group.name = "group name 1";
	group.header = "header 1";
	group.footer = "footer 1";	
    app.getGroupHelper().fillGroupForm(group);
    app.getGroupHelper().submitGroupCreation();
    app.getGroupHelper().returnToGroupsPage();
    
    //save new state
    List<GroupData> newList = app.getGroupHelper().getGroups();
    
    //compare states
    oldList.add(group);
    Collections.sort(oldList);
    assertEquals(newList, oldList);
  }
}

@@ -17,24 +17,52 @@
 ple.tests;%0A%0A
+import java.util.ArrayList;%0A
 import java.
@@ -96,20 +96,72 @@
 va.util.
-List
+Iterator;%0Aimport java.util.List;%0Aimport java.util.Random
 ;%0A%0Aimpor
@@ -198,24 +198,68 @@
 ertEquals;%0A%0A
+import org.testng.annotations.DataProvider;%0A
 import org.t
@@ -338,56 +338,678 @@
 e %7B%0A
-  @Test%0A  public void testNonEmptyGroupCreation(
+%09%0A%09@DataProvider%0A%09public Iterator%3CObject%5B%5D%3E randomValidGroupGenerator()%7B%0A%09%09List%3CObject%5B%5D%3E list = new ArrayList%3CObject%5B%5D%3E();%09%09%0A%09%09for (int i=0; i%3C5; i++)%0A%09%09%7B%0A%09%09%09GroupData group = new GroupData();%09%09%09%0A%09%09%09group.name = generateRandomString();%0A%09%09%09group.header = generateRandomString();%0A%09%09%09group.footer = generateRandomString();%0A%09%09%09list.add(new Object%5B%5D%7Bgroup%7D);%0A%09%09%7D%0A%09%09return list.iterator(); %0A%09%7D%0A%09%0A%09public String generateRandomString()%7B%0A%09%09Random rnd = new Random();%0A%09%09if (rnd.nextInt(3) == 0) %7B%0A%09%09%09return %22%22;%0A%09%09%7D else %7B%0A%09%09%09return %22test%22 + rnd.nextInt();%0A%09%09%7D%09%09%0A%09%7D%0A%09%0A  @Test(dataProvider = %22randomValidGroupGenerator%22)%0A  public void testGroupCreationWithValidData(GroupData group
 ) th
@@ -1273,134 +1273,8 @@
 ();%0A
-    GroupData group = new GroupData();%0A%09group.name = %22group name 1%22;%0A%09group.header = %22header 1%22;%0A%09group.footer = %22footer 1%22;%09%0A
     

Test testNonEmptyGroupCreation modified