<commit_before>package mypft.addressbook.tests;

import mypft.addressbook.model.ContactData;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;

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

public class ContactDetailsTests extends TestBase {

  @BeforeMethod
  public void ensurePreconditions() {
    app.goTo().HomePage();
    app.contact().selectContactAll();
    if (app.contact().all().size() == 0) {
      app.contact().create(new ContactData()
                      .withFirstname("Mariya").withLastname("(Barkovskaya)").withAddress("Taganrog\nstreet Karantinnaya")
                      .withHomePhone("9612345").withMobilePhone("+22").withWorkPhone("22-212").withEmail("<EMAIL>"),
              true);
    }
  }

  @Test
  public void testContactPreview() {
    ContactData contact = app.contact().all().iterator().next();
    String contactinfoFromDetailsForm = app.contact().infoFromDetailsForm(contact.getId());
    assertThat(mergeContact(contact), equalTo(contactinfoFromDetailsForm));
  }

  private String mergeContact(ContactData contact) {
    return Stream.of(cleaned(contact.getFirstname() + "" + contact.getLastname()), multiLineStringToString(contact.getAddress()),
            multiLineStringToString(contact.getAllPhones()), multiLineStringToString(contact.getAllEmails()))
            .filter((s) -> !s.equals("")).collect(Collectors.joining(";"));
  }

  public static String phoneCleaned(String phone) {
    return phone.replaceAll("^(?:[HMW]): (.*)", "$1").replaceAll("[\\s-()]", "");
  }

  private static String multiLineStringToString(String multiline) {
    return Arrays.stream(multiline.split("\n")).filter(s -> !s.equals("")).map(ContactDetailsTests::cleaned).collect(Collectors.joining(";"));
  }

  private static String cleaned(String str) {
    return str.replaceAll("[-()\\s]", "");
  }
}<commit_msg>создан ContactAddressTests сравнения почтового адреса главной страницы с адресом на странице редактирования контакта<commit_after>package mypft.addressbook.tests;

import mypft.addressbook.model.ContactData;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;

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

public class ContactDetailsTests extends TestBase {

  @BeforeMethod
  public void ensurePreconditions() {
    app.goTo().HomePage();
    app.contact().selectContactAll();
    if (app.contact().all().size() == 0) {
      app.contact().create(new ContactData()
                      .withFirstname("Mariya").withLastname("(Barkovskaya)").withAddress("Taganrog\nstreet Karantinnaya")
                      .withHomePhone("9612345").withMobilePhone("+22").withWorkPhone("22-212").withEmail("<EMAIL>"),
              true);
    }
  }

  @Test
  public void testContactPreview() {
    ContactData contact = app.contact().all().iterator().next();
    String contactinfoFromDetailsForm = app.contact().infoFromDetailsForm(contact.getId());
    assertThat(mergeContact(contact), equalTo(contactinfoFromDetailsForm));
  }

  private String mergeContact(ContactData contact) {
  return Stream.of(cleaned(contact.getFirstname() + "" + contact.getLastname()), multiLineStringToString(contact.getAddress()),
          multiLineStringToString(contact.getAllPhones()), multiLineStringToString(contact.getAllEmails()))
          .filter((s) -> !s.equals("")).collect(Collectors.joining(";"));
}

  public static String phoneCleaned(String phone) {
    return phone.replaceAll("^(?:[HMW]): (.*)", "$1").replaceAll("[\\s-()]", "");
  }

  private static String multiLineStringToString(String multiline) {
    return Arrays.stream(multiline.split("\n")).filter(s -> !s.equals("")).map(ContactDetailsTests::cleaned).collect(Collectors.joining(";"));
  }

  private static String cleaned(String str) {
    return str.replaceAll("[-()\\s]", "");
  }
}
{'fraction_non_alphanumeric': 0.1562273276904474, 'fraction_numerical': 0.007738814993954051, 'mean_word_length': 4.658002735978112, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '21109', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1222, 'n_words': 186}