<commit_before>/*
 Copyright (C) 2003 EBI, GRL
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.
 
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.
 
 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.ensembl.healthcheck.test;

import org.ensembl.healthcheck.Species;

import junit.framework.TestCase;

/**
 * Junit test case for Species
 */
public class SpeciesTest extends TestCase {

    public SpeciesTest(String arg) {

        super(arg);

    }

    // -----------------------------------------------------------------

    public void testToString() {

        Species s = Species.HOMO_SAPIENS;
        assertEquals("toString method not returning expected result", s.toString(), "homo_sapiens");

    }

    // -----------------------------------------------------------------

    public void testEquals() {

        assertEquals("equals method not working", Species.HOMO_SAPIENS, Species.HOMO_SAPIENS);
        assertTrue("compare with == not working", Species.DANIO_RERIO == Species.DANIO_RERIO);
        assertTrue("species that are the not the same are coming out equal",
                Species.TAKIFUGU_RUBRIPES != Species.CAENORHABDITIS_BRIGGSAE);

    }

    // -----------------------------------------------------------------

    public void testAlias() {

        // not an exhaustive list ...
        assertEquals(Species.resolveAlias("human"), Species.HOMO_SAPIENS);
        assertEquals(Species.resolveAlias("rat"), Species.RATTUS_NORVEGICUS);
        assertEquals(Species.resolveAlias("mus_musculus"), Species.MUS_MUSCULUS);
        assertEquals(Species.resolveAlias("tetraodon_nigroviridis"), Species.TETRAODON_NIGROVIRIDIS);
        assertEquals(Species.resolveAlias("apis_mellifera"), Species.APIS_MELLIFERA);
        assertEquals(Species.resolveAlias("ciona_intestinalis"), Species.CIONA_INTESTINALIS);
        
        assertEquals(Species.resolveAlias("littlegreenman"), Species.UNKNOWN);

    }

    // -----------------------------------------------------------------

    public void testTaxonomyIDs() {

        assertEquals(Species.getTaxonomyID(Species.HOMO_SAPIENS), "9606");
        assertEquals(Species.getTaxonomyID(Species.DANIO_RERIO), "7955");
        assertEquals(Species.getTaxonomyID(Species.TETRAODON_NIGROVIRIDIS), "99883");
        assertEquals(Species.getTaxonomyID(Species.CIONA_INTESTINALIS), "7719");
        assertEquals(Species.getTaxonomyID(Species.APIS_MELLIFERA), "7460");
        
        assertEquals(Species.getSpeciesFromTaxonomyID("10090"), Species.MUS_MUSCULUS);
        assertEquals(Species.getSpeciesFromTaxonomyID("10116"), Species.RATTUS_NORVEGICUS);

        assertEquals(Species.getTaxonomyID(Species.UNKNOWN), "");
        assertEquals(Species.getSpeciesFromTaxonomyID("-1"), Species.UNKNOWN);

    }

    // -----------------------------------------------------------------
    
    public void testSimilarNames() {
        
        assertTrue(!(Species.resolveAlias("hedgehog").equals(Species.ECHINOPS_TELFAIRI)));
        assertTrue(Species.resolveAlias("hedgehog").equals(Species.ERINACEUS_EUROPAEUS));
        
    }
    
 // -----------------------------------------------------------------
    
    public void testAssemblyPrefixes() {
        
        assertEquals(Species.getSpeciesForAssemblyPrefix("NCBI"), Species.HOMO_SAPIENS);
        
    }
    
    // -----------------------------------------------------------------

}
<commit_msg>*** empty log message ***<commit_after>/*
 Copyright (C) 2003 EBI, GRL
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.
 
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.
 
 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.ensembl.healthcheck.test;

import org.ensembl.healthcheck.Species;

import junit.framework.TestCase;

/**
 * Junit test case for Species
 */
public class SpeciesTest extends TestCase {

    public SpeciesTest(String arg) {

        super(arg);

    }

    // -----------------------------------------------------------------

    public void testToString() {

        Species s = Species.HOMO_SAPIENS;
        assertEquals("toString method not returning expected result", s.toString(), "homo_sapiens");

    }

    // -----------------------------------------------------------------

    public void testEquals() {

        assertEquals("equals method not working", Species.HOMO_SAPIENS, Species.HOMO_SAPIENS);
        assertTrue("compare with == not working", Species.DANIO_RERIO == Species.DANIO_RERIO);
        assertTrue("species that are the not the same are coming out equal",
                Species.TAKIFUGU_RUBRIPES != Species.CAENORHABDITIS_BRIGGSAE);

    }

    // -----------------------------------------------------------------

    public void testAlias() {

        // not an exhaustive list ...
        assertEquals(Species.resolveAlias("human"), Species.HOMO_SAPIENS);
        assertEquals(Species.resolveAlias("rat"), Species.RATTUS_NORVEGICUS);
        assertEquals(Species.resolveAlias("mus_musculus"), Species.MUS_MUSCULUS);
        assertEquals(Species.resolveAlias("tetraodon_nigroviridis"), Species.TETRAODON_NIGROVIRIDIS);
        assertEquals(Species.resolveAlias("apis_mellifera"), Species.APIS_MELLIFERA);
        assertEquals(Species.resolveAlias("ciona_intestinalis"), Species.CIONA_INTESTINALIS);
        
        assertEquals(Species.resolveAlias("littlegreenman"), Species.UNKNOWN);

    }

    // -----------------------------------------------------------------

    public void testTaxonomyIDs() {

        assertEquals(Species.getTaxonomyID(Species.HOMO_SAPIENS), "9606");
        assertEquals(Species.getTaxonomyID(Species.DANIO_RERIO), "7955");
        assertEquals(Species.getTaxonomyID(Species.TETRAODON_NIGROVIRIDIS), "99883");
        assertEquals(Species.getTaxonomyID(Species.CIONA_INTESTINALIS), "7719");
        assertEquals(Species.getTaxonomyID(Species.APIS_MELLIFERA), "7460");
        
        assertEquals(Species.getSpeciesFromTaxonomyID(10090), Species.MUS_MUSCULUS);
        assertEquals(Species.getSpeciesFromTaxonomyID(10116), Species.RATTUS_NORVEGICUS);

        assertEquals(Species.getTaxonomyID(Species.UNKNOWN), "");
        assertEquals(Species.getSpeciesFromTaxonomyID(-1), Species.UNKNOWN);

    }

    // -----------------------------------------------------------------
    
    public void testSimilarNames() {
        
        assertTrue(!(Species.resolveAlias("hedgehog").equals(Species.ECHINOPS_TELFAIRI)));
        assertTrue(Species.resolveAlias("hedgehog").equals(Species.ERINACEUS_EUROPAEUS));
        
    }
    
 // -----------------------------------------------------------------
    
    public void testAssemblyPrefixes() {
        
        assertEquals(Species.getSpeciesForAssemblyPrefix("NCBI"), Species.HOMO_SAPIENS);
        
    }
    
    // -----------------------------------------------------------------

}

{'fraction_non_alphanumeric': 0.1997000749812547, 'fraction_numerical': 0.012996750812296926, 'mean_word_length': 2.202480992396959, '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': '7583222', 'n_tokens_mistral': 2275, 'n_tokens_neox': 2111, 'n_words': 474}