<commit_before>package com.example.tests;

import java.time.Month;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;

import com.example.fw.ApplicationManager;

public class TestBase {
	protected static ApplicationManager app;

	@BeforeTest
	public void setUp() throws Exception {
		app = new ApplicationManager();
	}

	@AfterTest
	public void tearDown() throws Exception {
		app.stop();
	}
	
	// ==========================================================================
	// Data Providers
	// ==========================================================================

	@DataProvider
	public Iterator<Object[]> randomValidGroupGenerator() {
		List<Object[]> list = new ArrayList<Object[]>();
		for (int i = 0; i < 15; i++) {
			GroupData group = new GroupData()
					.withName(generateRandomString())
					.withHeader(generateRandomString())
					.withFooter(generateRandomString());
			list.add(new Object[] { group });
		}
		return list.iterator();
	}
	
	@DataProvider
	public Iterator<Object[]> randomValidContactGenerator() {
		app.getNavigationHelper().openMainPage();
		app.getNavigationHelper().gotoAddNewContact();
		
		List<Object[]> list = new ArrayList<Object[]>();
		Random rnd = new Random();
		for (int i = 0; i < 5; i++) {
			// prepare data
			String from0to31 = Integer.toString(rnd.nextInt(32));
			// group selection
			ArrayList<String> groupSelectOptions = app.getContactHelper().getGroupSelectOptions();
			int groupIndex = rnd.nextInt(groupSelectOptions.size() - 1);
			
			ContactData contact = new ContactData()
					.withFirstName(generateRandomString())
					.withLastName(generateRandomString())
					.withAddress(generateRandomString() + "\n" + generateRandomString())
					.withHomePhone(generateValidPhoneNumber())
					.withMobilePhone(generateValidPhoneNumber())
					.withWorkPhone(generateValidPhoneNumber())
					.withEmail_1(generateValidEmail(33))
					.withEmail_2(generateValidEmail(66))
					.withBirthDay(from0to31.equals("0") ? "-" : from0to31)
					.withBirthMonth(generateRandomMonth(true, "-"))
					.withBirthYear(Integer.toString(1900 + rnd.nextInt(115)))
					.withGroup(groupSelectOptions.get(groupIndex))
					.withAddressSecondary(generateRandomString() + "\n" + generateRandomString())
					.withPhoneSecondary(generateValidPhoneNumber());
			/*contact.firstName = generateRandomString();
			contact.lastName = generateRandomString();
			contact.address = generateRandomString() + "\n" + generateRandomString();
			contact.homePhone = generateValidPhoneNumber();
			contact.mobilePhone = generateValidPhoneNumber();
			contact.workPhone = generateValidPhoneNumber();
			contact.email_1 = generateValidEmail(33);
			contact.email_2 = generateValidEmail(66);
			
			contact.birthDay = from0to31.equals("0") ? "-" : from0to31;
			contact.birthMonth = generateRandomMonth(true, "-");
			contact.birthYear = Integer.toString(1900 + rnd.nextInt(115));
			
			
			contact.contactGroup = groupSelectOptions.get(groupIndex);
			
			contact.addressSecondary = generateRandomString() + "\n" + generateRandomString();
			contact.phoneSecondary = generateValidPhoneNumber();*/
			
			list.add(new Object[]{contact});
		}
		return list.iterator();
	}
	
	// ==========================================================================
	// test data generators
	// ==========================================================================

	public String generateRandomString() {
		Random rnd = new Random();
		if (rnd.nextInt(3) == 0) {
			return "";
		} else {
			return "test " + rnd.nextInt();
		}<commit_msg>commented code deleted<commit_after>package com.example.tests;

import java.time.Month;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;

import com.example.fw.ApplicationManager;

public class TestBase {
	protected static ApplicationManager app;

	@BeforeTest
	public void setUp() throws Exception {
		app = new ApplicationManager();
	}

	@AfterTest
	public void tearDown() throws Exception {
		app.stop();
	}
	
	// ==========================================================================
	// Data Providers
	// ==========================================================================

	@DataProvider
	public Iterator<Object[]> randomValidGroupGenerator() {
		List<Object[]> list = new ArrayList<Object[]>();
		for (int i = 0; i < 15; i++) {
			GroupData group = new GroupData()
					.withName(generateRandomString())
					.withHeader(generateRandomString())
					.withFooter(generateRandomString());
			list.add(new Object[] { group });
		}
		return list.iterator();
	}
	
	@DataProvider
	public Iterator<Object[]> randomValidContactGenerator() {
		app.getNavigationHelper().openMainPage();
		app.getNavigationHelper().gotoAddNewContact();
		
		List<Object[]> list = new ArrayList<Object[]>();
		Random rnd = new Random();
		for (int i = 0; i < 5; i++) {
			// prepare data
			String from0to31 = Integer.toString(rnd.nextInt(32));
			// group selection
			ArrayList<String> groupSelectOptions = app.getContactHelper().getGroupSelectOptions();
			int groupIndex = rnd.nextInt(groupSelectOptions.size() - 1);
			
			ContactData contact = new ContactData()
					.withFirstName(generateRandomString())
					.withLastName(generateRandomString())
					.withAddress(generateRandomString() + "\n" + generateRandomString())
					.withHomePhone(generateValidPhoneNumber())
					.withMobilePhone(generateValidPhoneNumber())
					.withWorkPhone(generateValidPhoneNumber())
					.withEmail_1(generateValidEmail(33))
					.withEmail_2(generateValidEmail(66))
					.withBirthDay(from0to31.equals("0") ? "-" : from0to31)
					.withBirthMonth(generateRandomMonth(true, "-"))
					.withBirthYear(Integer.toString(1900 + rnd.nextInt(115)))
					.withGroup(groupSelectOptions.get(groupIndex))
					.withAddressSecondary(generateRandomString() + "\n" + generateRandomString())
					.withPhoneSecondary(generateValidPhoneNumber());
			
			list.add(new Object[]{contact});
		}
		return list.iterator();
	}
	
	// ==========================================================================
	// test data generators
	// ==========================================================================

	public String generateRandomString() {
		Random rnd = new Random();
		if (rnd.nextInt(3) == 0) {
			return "";
		} else {
			return "test " + rnd.nextInt();
		}
{'fraction_non_alphanumeric': 0.2113578774780146, 'fraction_numerical': 0.012818601878074229, 'mean_word_length': 4.917107583774251, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3226470', 'n_tokens_mistral': 2202, 'n_tokens_neox': 1812, 'n_words': 346}