<commit_before>package com.github.mikhailerofeev.runity.domain.values;

import com.github.mikhailerofeev.runity.domain.DataUtil;
import com.github.mikhailerofeev.runity.domain.entities.Employee;
import com.github.mikhailerofeev.runity.domain.repository.EmployeeRepository;
import com.github.mikhailerofeev.runity.server.Application;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.List;

import static org.junit.Assert.assertEquals;

/**
 * Created by Максим on 27.04.2014.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@ActiveProfiles("test")
@DirtiesContext
public class PredicateFactoryTest {

    @Autowired
    EmployeeRepository employeeRepository;

    @Autowired
    DataUtil dataUtil;

    @Autowired
    MongoTemplate mongoTemplate;

    List<Employee> filteredEmployees;
    List<Employee> employees;

    @Before
    public void before() throws IOException {
        mongoTemplate.getDb().dropDatabase();
        dataUtil.uploadTestData();
        employees = employeeRepository.findAll();
    }

    @Test
    public void neqPredicateAndWhitespacesTest() {
        Predicate<Employee> neqPredicate = PredicateFactory.create("   employee.Район    !=    Петроградский район  ");
        filteredEmployees = Lists.newArrayList(Collections2.filter(employees, neqPredicate));
        assertEquals(employees.size() - 6, filteredEmployees.size());
    }<commit_msg>compile<commit_after>package com.github.mikhailerofeev.runity.domain.values;

import com.github.mikhailerofeev.runity.domain.TestDataUtil;
import com.github.mikhailerofeev.runity.domain.entities.Employee;
import com.github.mikhailerofeev.runity.domain.repository.EmployeeRepository;
import com.github.mikhailerofeev.runity.server.Application;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.List;

import static org.junit.Assert.assertEquals;

/**
 * Created by Максим on 27.04.2014.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@ActiveProfiles("test")
@DirtiesContext
public class PredicateFactoryTest {

    @Autowired
    EmployeeRepository employeeRepository;

    @Autowired
    TestDataUtil dataUtil;

    @Autowired
    MongoTemplate mongoTemplate;

    List<Employee> filteredEmployees;
    List<Employee> employees;

    @Before
    public void before() throws IOException {
        mongoTemplate.getDb().dropDatabase();
        dataUtil.uploadTestData();
        employees = employeeRepository.findAll();
    }

    @Test
    public void neqPredicateAndWhitespacesTest() {
        Predicate<Employee> neqPredicate = PredicateFactory.create("   employee.Район    !=    Петроградский район  ");
        filteredEmployees = Lists.newArrayList(Collections2.filter(employees, neqPredicate));
        assertEquals(employees.size() - 6, filteredEmployees.size());
    }
{'fraction_non_alphanumeric': 0.0984811366976972, 'fraction_numerical': 0.006859382655560999, 'mean_word_length': 5.103139013452915, 'pattern_counts': {'":': 0, '<': 9, '<?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': '834478', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1183, 'n_words': 190}