<commit_before>package ru.stqa.pft.addressbook.tests;

public class ContactEmailTests {
}<commit_msg>добавлен тест для проверки email ContactEmailTests<commit_after>package ru.stqa.pft.addressbook.tests;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ru.stqa.pft.addressbook.model.ContactData;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

public class ContactEmailTests extends TestBase {
  @BeforeMethod
  public void ensurePreconditions() {
    app.goTo().homePage();
    app.contact().deleteAll();
    app.contact().create(new ContactData().withName("John").withLastName("Smith")
            .withEmail("<EMAIL>").withEmail2("<EMAIL>").withEmail3("<EMAIL>").withGroup("a"));
  }

  @Test
  public void testContactEmail() {
    app.goTo().homePage();
    ContactData contact = app.contact().all().iterator().next();
    ContactData editFormContact = app.contact().editFormInfo(contact);
    assertThat(contact.getAllEmails().replaceAll("\n", ""), equalTo(sumEmails(editFormContact)));
  }

  public String sumEmails(ContactData contact) {
    return contact.getEmail() + contact.getEmail2() + contact.getEmail3();
  }
}
{'fraction_non_alphanumeric': 0.14414414414414414, 'fraction_numerical': 0.003276003276003276, 'mean_word_length': 5.431578947368421, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '2375170', 'n_tokens_mistral': 375, 'n_tokens_neox': 372, 'n_words': 59}