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

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

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

public class ContactModificationTests extends TestBase {

  @BeforeMethod
  public void ensurePreconditions() {
    app.goTo().homepage();
    if (app.contact().all().size() == 0) {
      app.contact().create(new ContactData()
                      .withFirstname("First").withLastname("Last")
                      .withHome("111-111").withMobile("+79010000001").withWork("666 666")
                      .withAddress("Address")
                      .withEmail("<EMAIL>").withEmail2("<EMAIL>").withEmail3("<EMAIL>"));
      app.goTo().homepage();
    }
  }

  @Test
  public void testContactModification() {
    Contacts before = app.contact().all();
    ContactData modifiedContact = before.iterator().next();
    ContactData contact = new ContactData()
            .withId(modifiedContact.getId())
            .withFirstname("First").withMiddlename("Middle").withLastname("Last")
            .withNickname("Nickname").withTitle("Title").withCompany("Company").withAddress("Address")
            .withMobile("+79010000001").withEmail("<EMAIL>").withHomepage("homepage.com")
            .withBday("3").withBmonth("2").withBirthyear("1950");
    app.contact().modify(contact);
    app.goTo().homepage();
    Contacts after = app.contact().all();

    assertEquals(after.size(), before.size());
    assertThat(after, equalTo(before.without(modifiedContact).withAdded(contact)));
  }

}<commit_msg>Корректировка теста для модификации контактов<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 ru.stqa.pft.addressbook.model.Contacts;

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

public class ContactModificationTests extends TestBase {

  @BeforeMethod
  public void ensurePreconditions() {
    app.goTo().homepage();
    if (app.contact().all().size() == 0) {
      app.contact().create(new ContactData()
                      .withFirstname("First").withLastname("Last")
                      .withHome("111-111").withMobile("+79010000001").withWork("666 666")
                      .withAddress("Address")
                      .withEmail("<EMAIL>").withEmail2("<EMAIL>").withEmail3("<EMAIL>"));
      app.goTo().homepage();
    }
  }

  @Test
  public void testContactModification() {
    Contacts before = app.contact().all();
    ContactData modifiedContact = before.iterator().next();
    ContactData contact = new ContactData()
            .withId(modifiedContact.getId())
            .withFirstname("First").withLastname("Last")
            .withAddress("Address")
            .withMobile("+79010000001").withEmail("<EMAIL>").withHomepage("homepage.com")
            .withBday("3").withBmonth("2").withBirthyear("1950");
    app.contact().modify(contact);
    app.goTo().homepage();
    Contacts after = app.contact().all();

    assertEquals(after.size(), before.size());
    assertThat(after, equalTo(before.without(modifiedContact).withAdded(contact)));
  }

}
{'fraction_non_alphanumeric': 0.15551743853630645, 'fraction_numerical': 0.024585477415666093, 'mean_word_length': 3.5858453473132372, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4446565', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1020, 'n_words': 140}