@@ -0,0 +1,2786 @@
+package gov.nih.nci.cabig.caaers.web.study;%0D%0A%0D%0Aimport gov.nih.nci.cabig.caaers.dao.SiteDao;%0D%0Aimport gov.nih.nci.cabig.caaers.dao.StudyDao;%0D%0Aimport gov.nih.nci.cabig.caaers.domain.Site;%0D%0Aimport gov.nih.nci.cabig.caaers.utils.ConfigProperty;%0D%0Aimport gov.nih.nci.cabig.caaers.web.CreateStudyController;%0D%0Aimport gov.nih.nci.cabig.caaers.web.WebTestCase;%0D%0A%0D%0Aimport java.util.ArrayList;%0D%0Aimport java.util.List;%0D%0A%0D%0Aimport org.springframework.web.servlet.ModelAndView;%0D%0A%0D%0A/**%0D%0A * @author Kulasekaran%0D%0A */%0D%0Apublic class CreateStudyControllerTest extends WebTestCase %7B%0D%0A%09%0D%0A%09private CreateStudyController controller = new CreateStudyController();%0D%0A    private StudyDao studyDao;%0D%0A%09private SiteDao siteDao;%0D%0A    %09%0D%0A    protected void setUp() throws Exception %7B%0D%0A        super.setUp();%0D%0A        studyDao = registerDaoMockFor(StudyDao.class);        %0D%0A        // siteDao = registerDaoMockFor(SiteDao.class);%0D%0A        siteDao = new SiteDao() %7B%0D%0A        %09@Override%0D%0A        %09public List%3CSite%3E getAll() %7B        %09%09        %09%09%0D%0A        %09%09List%3CSite%3E sites = new ArrayList%3CSite%3E();%0D%0A        %09%09return sites;%0D%0A        %09%7D%0D%0A        %7D;%0D%0A        controller.setStudyDao(studyDao);%0D%0A%09%09controller.setSiteDao(siteDao);%0D%0A%09%09controller.setConfigurationProperty(new ConfigProperty());%0D%0A    %7D%0D%0A    %0D%0A    public void testViewOnGet() throws Exception %7B%0D%0A        request.setMethod(%22GET%22);%0D%0A        ModelAndView mv = controller.handleRequest(request, response);%0D%0A        assertEquals(%22study_details%22, mv.getViewName());%0D%0A    %7D%0D%0A%0D%0A    public void testViewOnGoodSubmit() throws Exception %7B%0D%0A        request.addParameter(%22multiInstitutionIndicator%22, %22true%22);%0D%0A        request.addParameter(%22shortTitle%22, %22Scott%22);%0D%0A        request.addParameter(%22longTitle%22, %22Male%22);%0D%0A        request.addParameter(%22description%22, %22Description%22);%0D%0A        request.addParameter(%22primarySponsorCode%22, %22Primary Sponsor Code%22);%0D%0A        request.addParameter(%22phaseCode%22, %22PhaseCode%22);%0D%0A        //request.addParameter(%22reviewDate%22, %222006-01-01%22);%0D%0A        request.setParameter(%22_target1%22, %22%22);%0D%0A        %0D%0A        controller.handleRequest(request, response);%0D%0A        ModelAndView mv = controller.handleRequest(request, response);%0D%0A        assertEquals(%22study_identifiers%22, mv.getViewName());%0D%0A    %7D    %0D%0A   %0D%0A   /*private NewParticipantCommand postAndReturnCommand() throws Exception %7B%0D%0A        request.setMethod(%22POST%22);%0D%0A        participantDao.save((Participant) notNull());  %0D%0A        expectLastCall().atLeastOnce().asStub();%0D%0A%0D%0A        replayMocks();%0D%0A        ModelAndView mv = controller.handleRequest(request, response);%0D%0A        verifyMocks();%0D%0A%0D%0A        Object command = mv.getModel().get(%22command%22);%0D%0A        assertNotNull(%22Command not present in model: %22 + mv.getModel(), command);%0D%0A        return (NewParticipantCommand) command;%0D%0A    %7D */%0D%0A%7D%0D%0A

test case for create study controller