package edu.duke.cabig.c3pr.service;

import static edu.duke.cabig.c3pr.C3PRUseCase.CREATE_RESEARCH_STAFF;
import static edu.duke.cabig.c3pr.C3PRUseCase.CREATE_STUDY_INVESTIGATOR;
import edu.duke.cabig.c3pr.C3PRUseCases;
import edu.duke.cabig.c3pr.dao.HealthcareSiteInvestigatorDao;
import edu.duke.cabig.c3pr.domain.ContactMechanism;
import edu.duke.cabig.c3pr.domain.ContactMechanismType;
import edu.duke.cabig.c3pr.domain.Investigator;
import edu.duke.cabig.c3pr.utils.MasqueradingDaoTestCase;

/**
 * Created by IntelliJ IDEA. User: kherm Date: Aug 26, 2007 Time: 12:33:44 PM To change this
 * template use File | Settings | File Templates.
 */
@C3PRUseCases( { CREATE_RESEARCH_STAFF, CREATE_STUDY_INVESTIGATOR })
public class PersonnelServiceTest extends MasqueradingDaoTestCase<HealthcareSiteInvestigatorDao> {

    private PersonnelService service;

    Investigator inv;

    protected void setUp() throws Exception {
        super.setUp(); // To change body of overridden methods use File | Settings | File
                        // Templates.
        service = (PersonnelService) getApplicationContext().getBean("personnelService");

        inv = new Investigator();
        inv.setFirstName("Dummy");
        inv.setLastName("User");

        ContactMechanism cm = new ContactMechanism();
        cm.setType(ContactMechanismType.EMAIL);
        cm.setValue("dummy@dummy.org");

        inv.addContactMechanism(cm);

    }

    public void testCreateUser() throws Exception {
        service.save(inv);

    }

    /**
     * What dao class is the test trying to Masquerade
     * 
     * @return
     */
    public Class<HealthcareSiteInvestigatorDao> getMasqueradingDaoClassName() {
        return HealthcareSiteInvestigatorDao.class;
    }
}

@@ -1425,24 +1425,159 @@
 m);%0A%0A    %7D%0A%0A
+    @Override%0A    protected void tearDown() throws Exception %7B%0A    %09inv.getContactMechanisms().remove(0);%0A    %09super.tearDown();%0A    %7D%0A
     public v

test case fix