<commit_before>package uk.ac.ebi.quickgo.ontology.common.coterms;

import java.io.IOException;
import java.util.*;
import java.util.function.Predicate;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.io.Resource;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * @author <NAME>
 * Date: 11/10/2016
 * Time: 14:57
 * Created with IntelliJ IDEA.
 */
public class CoTermRepositorySimpleMapTest {

    public static final String ID_1 = "GO:0001234";
    public static final String ID_2 = "GO:0003870";
    public static final String ID_3 = "GO:0009058";
    public static final String ID_4 = "GO:0016857";
    public static final String ID_5 = "GO:0009999";
    public static final String ID_6 = "GO:0055085";

    public static final CoTerm CO_TERM_A1X = new CoTerm(ID_1, ID_1, 79f, 46f, 838, 933);
    public static final CoTerm CO_TERM_A1Y = new CoTerm(ID_1, ID_2, 54f, 55f, 335, 9424);
    public static final CoTerm CO_TERM_A1Z = new CoTerm(ID_1, ID_3, 24f, 24f, 5732, 355);
    public static final CoTerm CO_TERM_A2X = new CoTerm(ID_4, ID_1, 34f, 66f, 556, 872);
    public static final CoTerm CO_TERM_MX  = new CoTerm(ID_6, ID_5, 99f, 47f, 34356, 456);
    public static final CoTerm CO_TERM_MY  = new CoTerm(ID_6, ID_1, 24f, 4f, 465, 4564);
    public static final Predicate<CoTerm> NO_FILTER = t -> true;

    private CoTermRepositorySimpleMap coTermRepository;

    @Before
    public void setup() {
        Map<String, List<CoTerm>> coTermsAll = new HashMap<>();
        coTermsAll.put(ID_1, Arrays.asList(CO_TERM_A1X, CO_TERM_A1Y, CO_TERM_A1Z));
        coTermsAll.put(ID_4, Collections.singletonList(CO_TERM_A2X));

        Map<String, List<CoTerm>> coTermsManual = new HashMap<>();
        coTermsManual.put(ID_6, Arrays.asList(CO_TERM_MX, CO_TERM_MY));

        coTermRepository = CoTermRepositorySimpleMap.createCoTermRepositorySimpleMap(coTermsAll, coTermsManual);

    }

    @Test
    public void retrievalIsSuccessfulFromAll() {<commit_msg>Formatting.<commit_after>package uk.ac.ebi.quickgo.ontology.common.coterms;

import java.io.IOException;
import java.util.*;
import java.util.function.Predicate;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.io.Resource;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * @author <NAME>
 * Date: 11/10/2016
 * Time: 14:57
 * Created with IntelliJ IDEA.
 */
public class CoTermRepositorySimpleMapTest {

    public static final String ID_1 = "GO:0001234";
    public static final String ID_2 = "GO:0003870";
    public static final String ID_3 = "GO:0009058";
    public static final String ID_4 = "GO:0016857";
    public static final String ID_5 = "GO:0009999";
    public static final String ID_6 = "GO:0055085";

    public static final CoTerm CO_TERM_A1X = new CoTerm(ID_1, ID_1, 79f, 46f, 838, 933);
    public static final CoTerm CO_TERM_A1Y = new CoTerm(ID_1, ID_2, 54f, 55f, 335, 9424);
    public static final CoTerm CO_TERM_A1Z = new CoTerm(ID_1, ID_3, 24f, 24f, 5732, 355);
    public static final CoTerm CO_TERM_A2X = new CoTerm(ID_4, ID_1, 34f, 66f, 556, 872);
    public static final CoTerm CO_TERM_MX = new CoTerm(ID_6, ID_5, 99f, 47f, 34356, 456);
    public static final CoTerm CO_TERM_MY = new CoTerm(ID_6, ID_1, 24f, 4f, 465, 4564);
    public static final Predicate<CoTerm> NO_FILTER = t -> true;

    private CoTermRepositorySimpleMap coTermRepository;

    @Before
    public void setup() {
        Map<String, List<CoTerm>> coTermsAll = new HashMap<>();
        coTermsAll.put(ID_1, Arrays.asList(CO_TERM_A1X, CO_TERM_A1Y, CO_TERM_A1Z));
        coTermsAll.put(ID_4, Collections.singletonList(CO_TERM_A2X));

        Map<String, List<CoTerm>> coTermsManual = new HashMap<>();
        coTermsManual.put(ID_6, Arrays.asList(CO_TERM_MX, CO_TERM_MY));

        coTermRepository = CoTermRepositorySimpleMap.createCoTermRepositorySimpleMap(coTermsAll, coTermsManual);

    }

    @Test
    public void retrievalIsSuccessfulFromAll() {
{'fraction_non_alphanumeric': 0.10307212822796082, 'fraction_numerical': 0.06544968833481746, 'mean_word_length': 4.426328502415459, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '4829437', 'n_tokens_mistral': 1794, 'n_tokens_neox': 1583, 'n_words': 386}