package com.example.tests;

import static org.testng.Assert.assertEquals;

import java.util.List;
import java.util.Random;

import org.testng.annotations.Test;

public class ContactRemovalTests extends TestBase {

	@Test
	public void removeContact() {
		app.getNavigationHelper().openMainPage();

		// save initial contacts list
		List<ContactData> initialContacts = app.getContactHelper().getContacts();
		
		Random rnd = new Random();
		int index = rnd.nextInt(initialContacts.size() - 1);

		// actions
		app.getContactHelper().initContactEdit(index);
		app.getContactHelper().submitDeleteContact();
		app.getContactHelper().returnToHomePage();

		// save new contact list
		List<ContactData> newContacts = app.getContactHelper().getContacts();

		// compare states
		initialContacts.remove(index);
		assertEquals(newContacts, initialContacts);
	}
}

@@ -401,16 +401,81 @@
 s();%0A%09%09%0A
+%09%09for (int i = 0; i %3C 25 && initialContacts.size() %3E 20; i++) %7B%0A%09
 %09%09Random
@@ -495,16 +495,17 @@
 ndom();%0A
+%09
 %09%09int in
@@ -554,16 +554,17 @@
  1);%0A%0A%09%09
+%09
 // actio
@@ -566,16 +566,17 @@
 actions%0A
+%09
 %09%09app.ge
@@ -614,24 +614,25 @@
 t(index);%0A%09%09
+%09
 app.getConta
@@ -667,16 +667,17 @@
 ct();%0A%09%09
+%09
 app.getC
@@ -706,24 +706,62 @@
 oHomePage();
+%0A%09%09%09initialContacts.remove(index);%0A%09%09%7D
 %0A%0A%09%09// save 
@@ -874,41 +874,8 @@
 tes%0A
-%09%09initialContacts.remove(index);%0A
 %09%09as

delete many contacts