@@ -0,0 +1,1956 @@
+package edu.columbia.gemma.sequence.gene;%0A%0Aimport edu.columbia.gemma.BaseDAOTestCase;%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0A//import org.springframework.dao.DataIntegrityViolationException;%0Aimport java.util.Collection;%0A/**%0A * %3CHR%3E%0A * %3CP%3E%0A * Copyright (c) 2005 Columbia University%0A * @author daq2101%0A */%0Apublic class CandidateGeneDaoImplTest extends BaseDAOTestCase %7B%0A%0A    private final Log log = LogFactory.getLog(CandidateGeneDaoImplTest.class);%0A    private CandidateGeneDao daoCG = null;%0A    private GeneDao daoGene = null;%0A    private TaxonDao daoTaxon = null;%0A    private Gene g = null;%0A    private CandidateGene cg = null;%0A%09private Taxon t = null;%0A    protected void setUp() throws Exception %7B%0A%09%09super.setUp();%0A%09%0A%09%09// create a taxon and a gene for that taxon%0A%09%09daoCG = (CandidateGeneDao) ctx.getBean(%22candidateGeneDao%22);%0A%09%09daoGene = (GeneDao) ctx.getBean(%22geneDao%22);%0A%09%09daoTaxon = (TaxonDao) ctx.getBean(%22taxonDao%22);%0A%09%09%0A%09%09t = daoTaxon.findByCommonName(%22mouse%22);%0A%09%09if( t==null)%7B%0A%09%09    t = Taxon.Factory.newInstance();%0A%09%09    t.setCommonName(%22mouse%22);%0A%09%09%09t.setName(%22mouse%22);%0A%09%09%09daoTaxon.create(t);%0A%09%09%7D%0A%09%09Collection c = daoGene.findByOfficalName(%22testmygene%22);%0A%09%09if( c.isEmpty() )%7B%0A%09%09    g = Gene.Factory.newInstance();%0A%09%09%09g.setName(%22testmygene%22);%0A%09%09%09g.setSymbol(%22foo%22);%0A%09%09%09g.setOfficialName(%22testmygene%22);%0A%09%09%09g.setTaxon(t);%0A%09%09%09daoGene.create(g);%0A%09%09%7D%0A%09%09else%0A%09%09    g = (Gene)c.iterator().next();%0A%09%7D%0A%0A%0A%09protected void tearDown() throws Exception %7B%0A%09%09super.tearDown();%0A%09    daoCG.remove(cg);%0A%09%09daoCG = null;%0A%09%09daoGene.remove(g);%0A%09%09daoGene = null;%0A%09%09daoTaxon.remove(t);%0A%09%09daoTaxon=null;%0A%09%7D%0A%0A%09public void testSetCandidateGene() %7B%0A%09  %0A%09    cg = CandidateGene.Factory.newInstance();%0A%09    cg.setRank(new Integer(1));%0A%09    Gene gFromDB = (Gene) daoGene.findByOfficalName(%22testmygene%22).iterator().next();%0A%09    cg.setGene(gFromDB);%0A%09    daoCG.create(cg);%0A%09    %0A%09    assertTrue(cg.getGene().equals(gFromDB));%0A%09    %0A%09%7D%0A%0A%7D%0A

test for CandidateGene