<commit_before>package uk.ac.ebi.atlas.species;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.inject.Inject;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"/applicationContext.xml", "/solrContext.xml", "/embeddedSolrServerContext.xml", "/oracleContext.xml"})
public class SpeciesFactoryIT {

    @Inject
    private SpeciesFactory subject;

    @Test
    public void differentSpeciesSameProperties() {
        Species oryzaJaponica = subject.create("Oryza sativa Japonica group");
        Species oryzaIndica = subject.create("Oryza sativa Indica group");

        assertThat(oryzaJaponica.isUnknown(), is(false));
        assertThat(oryzaIndica.isUnknown(), is(false));

        assertThat(oryzaJaponica.getName(), is(not(oryzaIndica.getName())));

        assertThat(oryzaJaponica.getReferenceName(), is(oryzaIndica.getReferenceName()));
        assertThat(oryzaJaponica.getEnsemblName(), is(oryzaIndica.getEnsemblName()));
        assertThat(oryzaJaponica.getDefaultQueryFactorType(), is(oryzaIndica.getDefaultQueryFactorType()));
        assertThat(oryzaJaponica.getKingdom(), is(oryzaIndica.getKingdom()));
        assertThat(oryzaJaponica.isPlant(), is(true));
        assertThat(oryzaIndica.isPlant(), is(true));
    }

    @Test
    public void unknownSpecies() {
        assertThat(subject.create("foobar").isUnknown(), is(true));
    }
}<commit_msg>A few tests to check robustness of SpeciesFactory with edge cases<commit_after>package uk.ac.ebi.atlas.species;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.inject.Inject;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"/applicationContext.xml", "/solrContext.xml", "/embeddedSolrServerContext.xml", "/oracleContext.xml"})
public class SpeciesFactoryIT {

    @Inject
    private SpeciesFactory subject;

    @Test
    public void differentSpeciesSameProperties() {
        Species oryzaJaponica = subject.create("Oryza sativa Japonica group");
        Species oryzaIndica = subject.create("Oryza sativa Indica group");

        assertThat(oryzaJaponica.isUnknown(), is(false));
        assertThat(oryzaIndica.isUnknown(), is(false));

        assertThat(oryzaJaponica.getName(), is(not(oryzaIndica.getName())));

        assertThat(oryzaJaponica.getReferenceName(), is(oryzaIndica.getReferenceName()));
        assertThat(oryzaJaponica.getEnsemblName(), is(oryzaIndica.getEnsemblName()));
        assertThat(oryzaJaponica.getDefaultQueryFactorType(), is(oryzaIndica.getDefaultQueryFactorType()));
        assertThat(oryzaJaponica.getKingdom(), is(oryzaIndica.getKingdom()));
        assertThat(oryzaJaponica.isPlant(), is(true));
        assertThat(oryzaIndica.isPlant(), is(true));
    }

    @Test
    public void unknownSpecies() {
        assertThat(subject.create("foobar").isUnknown(), is(true));
    }

    @Test
    public void emptySpecies() {
        assertThat(subject.create("").isUnknown(), is(true));
    }

    @Test
    public void nullSpecies() {
        assertThat(subject.create(null).isUnknown(), is(true));
    }

}
{'fraction_non_alphanumeric': 0.12611111111111112, 'fraction_numerical': 0.0016666666666666668, 'mean_word_length': 4.789389067524116, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '417252', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1082, 'n_words': 168}