<commit_before>package org.digidoc4j;

import java.util.Date;

import org.digidoc4j.utils.PKCS12Signer;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;

public class SignatureTest {
  private Signer signer;

  @Before
  public void setUp() {
    signer = new PKCS12Signer("signout.p12", "test");
  }

  @Test
  public void testGetCity() {
    signer.setSignatureProductionPlace("myCity", "myState", "myPostalCode", "myCountry");
    Signature signature = new Signature(null, signer);
    assertEquals("myCity", signature.getCity());
    assertEquals("myCountry", signature.getCountryName());
    assertEquals("myPostalCode", signature.getPostalCode());
    assertEquals("myState", signature.getStateOrProvince());
  }

  @Test
  public void testGetSignerRoles() {
    signer.setSignerRoles(asList("Role / Resolution"));
    Signature signature = new Signature(null, signer);
    assertEquals(1, signature.getSignerRoles().size());
    assertEquals("Role / Resolution", signature.getSignerRoles().get(0));
  }

  @Test
  public void testGetMultipleSignerRoles() {
    signer.setSignerRoles(asList("Role 1", "Role 2"));
    Signature signature = new Signature(null, signer);
    assertEquals(2, signature.getSignerRoles().size());
    assertEquals("Role 1", signature.getSignerRoles().get(0));
    assertEquals("Role 2", signature.getSignerRoles().get(1));
  }

  @Test
  @Ignore
  public void testSigningProperties() throws Exception {
    Date dateBeforeTest = new Date();
    Container bDocContainer = new Container();
    bDocContainer.addDataFile("test.txt", "text/plain");
    PKCS12Signer signer = new PKCS12Signer("signout.p12", "test");
    signer.setSignatureProductionPlace("city", "stateOrProvince", "postalCode", "country");
    signer.setSignerRoles(asList("signerRoles"));
    Signature signature = bDocContainer.sign(signer);

    //assertTrue(signature.getSigningTime().before(new Date()) && signature.getSigningTime().after(dateBeforeTest));
  }
}<commit_msg>refactoring<commit_after>package org.digidoc4j;

import java.util.Date;

import org.digidoc4j.utils.PKCS12Signer;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class SignatureTest {
  private Signer signer;

  @Before
  public void setUp() {
    signer = new PKCS12Signer("signout.p12", "test");
  }

  @Test
  public void testGetCity() {
    signer.setSignatureProductionPlace("myCity", "myState", "myPostalCode", "myCountry");
    Signature signature = new Signature(null, signer);
    assertEquals("myCity", signature.getCity());
    assertEquals("myCountry", signature.getCountryName());
    assertEquals("myPostalCode", signature.getPostalCode());
    assertEquals("myState", signature.getStateOrProvince());
  }

  @Test
  public void testGetSignerRoles() {
    signer.setSignerRoles(asList("Role / Resolution"));
    Signature signature = new Signature(null, signer);
    assertEquals(1, signature.getSignerRoles().size());
    assertEquals("Role / Resolution", signature.getSignerRoles().get(0));
  }

  @Test
  public void testGetMultipleSignerRoles() {
    signer.setSignerRoles(asList("Role 1", "Role 2"));
    Signature signature = new Signature(null, signer);
    assertEquals(2, signature.getSignerRoles().size());
    assertEquals("Role 1", signature.getSignerRoles().get(0));
    assertEquals("Role 2", signature.getSignerRoles().get(1));
  }

  @Test
  @Ignore
  public void testSigningProperties() throws Exception {
    Date dateBeforeTest = new Date();
    Container bDocContainer = new Container();
    bDocContainer.addDataFile("test.txt", "text/plain");
    PKCS12Signer signer = new PKCS12Signer("signout.p12", "test");
    signer.setSignatureProductionPlace("city", "stateOrProvince", "postalCode", "country");
    signer.setSignerRoles(asList("signerRoles"));
    Signature signature = bDocContainer.sign(signer);

    assertTrue(signature.getSigningTime().before(new Date()) && signature.getSigningTime().after(dateBeforeTest));
  }
}
{'fraction_non_alphanumeric': 0.13779995248277502, 'fraction_numerical': 0.01092896174863388, 'mean_word_length': 5.218611521418021, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4136805', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1276, 'n_words': 249}