package white.box.tester.tests;

import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import white.box.tester.model.GroupData;
import white.box.tester.model.Groups;

import java.util.List;
import java.util.Set;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.testng.Assert.assertEquals;

/**
 * Created by Max on 9/19/2016.
 */
public class GroupDeletingTests extends TestBase {

  @BeforeMethod
  public void ensurePreconditions() {
    app.goTo().GroupPage();
    if (app.group().all().size() == 0){
      app.group().create(new GroupData().withName("Test2"));}
  }

  @Test
  public void testsGroups() {

    app.goTo().GroupPage();
    Groups before = app.group().all();
    GroupData deletedGroup = before.iterator().next();
    app.group().delete(deletedGroup);
    Groups after = app.group().all();
    assertEquals(after.size(), before.size() - 1);
    assertThat(after, equalTo(before.withOut(deletedGroup)));

  }


}




@@ -662,27 +662,27 @@
 if (app.
-group().all
+db().groups
 ().size(
@@ -690,16 +690,46 @@
  == 0)%7B%0A
+      app.goTo().GroupPage();%0A
       ap
@@ -775,17 +775,22 @@
 me(%22
-Test2
+test1
 %22));
+%0A    
 %7D%0A  
@@ -879,35 +879,35 @@
 efore = app.
-group().all
+db().groups
 ();%0A    Grou
@@ -1018,19 +1018,19 @@
 app.
-group().all
+db().groups
 ();%0A
@@ -1146,15 +1146,12 @@
 ));%0A
-%0A
   %7D%0A
-%0A%0A
 %7D%0A%0A%0A

Update 7.4 Group Deleting