// Path: src/main/java/io/aif/language/token/separator/ITokenSeparatorExtractor.java
// public interface ITokenSeparatorExtractor extends IExtractor<String, List<Character>> {
//   final ISettings settings = Guice.createInjector(new SettingsModule()).getInstance(ISettings.class);
//   public static enum Type {
// 
//     PREDEFINED(new PredefinedTokenSeparatorExtractor(settings)),
//     PROBABILITY(new ProbabilityBasedTokenSeparatorExtractor());
// 
//     private final ITokenSeparatorExtractor instance;
// 
//     private Type(final ITokenSeparatorExtractor instance) {
//       this.instance = instance;
//     }
// 
//     public ITokenSeparatorExtractor getInstance() {
//       return instance;
//     }
// 
//   }
// 
// }


import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import io.aif.language.token.separator.ITokenSeparatorExtractor;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
package io.aif.language.token;






public class ITTokenizerTest {

  //This two String are pathes for gethering statistic
  private static final String SETTINGS_PATH = "/settings.xml";
  private static final String ROOT_RESOURCES_PATH = "/../../src/main/resources/";
  //This two String are pathes for gethering statistic
  private static final String PATH_TO_STATISTIC_SET =
      "/Users/admin/Documents/programming/projects/AIF2/testData";
  private static final String PATH_TO_STATISTIC_RESULT = "/Users/admin/Documents/programming/" +
      "projects/AIF2/AIF2/src/main/resources/testData/RU/Results.csv";
  private Document doc;

  @BeforeMethod
  public void testResoursesEnitialize() {
    try {
      final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      doc = factory
          .newDocumentBuilder()
          .parse(new File(getClass().getResource(SETTINGS_PATH).toURI()));

    } catch (ParserConfigurationException | IOException | URISyntaxException | SAXException e) {
      e.printStackTrace();
    }
  }


  @Test(groups = {"acceptance-tests", "functional-fast"})
  public void shouldGetTokensFromTextFileWithSpaceInTheBeginingUsingPREDEFINEDSeparator() {
    try {
      final Path PathToFile =
          Paths.get(getClass().getResource("/texts/RU/RU_text_with_space_begining.txt").toURI());

      //Expected results:
      final String lastToken = "токенов.";
      final String firstToken = "-";
      final long numberOfTokens = 8;

      final Tokenizer tokenizer =
// Path: src/main/java/io/aif/language/token/separator/ITokenSeparatorExtractor.java
// public interface ITokenSeparatorExtractor extends IExtractor<String, List<Character>> {
//   final ISettings settings = Guice.createInjector(new SettingsModule()).getInstance(ISettings.class);
//   public static enum Type {
// 
//     PREDEFINED(new PredefinedTokenSeparatorExtractor(settings)),
//     PROBABILITY(new ProbabilityBasedTokenSeparatorExtractor());
// 
//     private final ITokenSeparatorExtractor instance;
// 
//     private Type(final ITokenSeparatorExtractor instance) {
//       this.instance = instance;
//     }
// 
//     public ITokenSeparatorExtractor getInstance() {
//       return instance;
//     }
// 
//   }
// 
// }


// Path: src/test/integration/java/io/aif/language/token/ITTokenizerTest.java
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import io.aif.language.token.separator.ITokenSeparatorExtractor;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;

package io.aif.language.token;






public class ITTokenizerTest {

  //This two String are pathes for gethering statistic
  private static final String SETTINGS_PATH = "/settings.xml";
  private static final String ROOT_RESOURCES_PATH = "/../../src/main/resources/";
  //This two String are pathes for gethering statistic
  private static final String PATH_TO_STATISTIC_SET =
      "/Users/admin/Documents/programming/projects/AIF2/testData";
  private static final String PATH_TO_STATISTIC_RESULT = "/Users/admin/Documents/programming/" +
      "projects/AIF2/AIF2/src/main/resources/testData/RU/Results.csv";
  private Document doc;

  @BeforeMethod
  public void testResoursesEnitialize() {
    try {
      final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      doc = factory
          .newDocumentBuilder()
          .parse(new File(getClass().getResource(SETTINGS_PATH).toURI()));

    } catch (ParserConfigurationException | IOException | URISyntaxException | SAXException e) {
      e.printStackTrace();
    }
  }


  @Test(groups = {"acceptance-tests", "functional-fast"})
  public void shouldGetTokensFromTextFileWithSpaceInTheBeginingUsingPREDEFINEDSeparator() {
    try {
      final Path PathToFile =
          Paths.get(getClass().getResource("/texts/RU/RU_text_with_space_begining.txt").toURI());

      //Expected results:
      final String lastToken = "токенов.";
      final String firstToken = "-";
      final long numberOfTokens = 8;

      final Tokenizer tokenizer =
          new Tokenizer(ITokenSeparatorExtractor.Type.PREDEFINED.getInstance());