@@ -0,0 +1,2390 @@
+package gov.nih.nci.cabig.caaers.web.search;%0D%0A%0D%0Aimport gov.nih.nci.cabig.caaers.dao.AdvancedSearchDao;%0D%0Aimport gov.nih.nci.cabig.caaers.dao.SearchDao;%0D%0Aimport gov.nih.nci.cabig.caaers.web.WebTestCase;%0D%0Aimport gov.nih.nci.cabig.caaers.web.search.ui.AdvancedSearchUi;%0D%0Aimport gov.nih.nci.cabig.caaers.web.search.ui.ViewColumn;%0D%0A%0D%0Aimport java.io.File;%0D%0Aimport java.io.FileReader;%0D%0Aimport java.net.URL;%0D%0Aimport java.util.ArrayList;%0D%0Aimport java.util.List;%0D%0A%0D%0Aimport org.springframework.validation.BindException;%0D%0A%0D%0A/**%0D%0A *%0D%0A * @author Ramakrishna Gundala%0D%0A */%0D%0Apublic class ExportSearchResultsControllerTest extends WebTestCase %7B%0D%0A%09%0D%0A%09protected ExportSearchResultsController controller;%0D%0A%09%0D%0A%09protected SearchDao searchDao;%0D%0A%09protected AdvancedSearchUi advancedSearchUi;%0D%0A%09protected AdvancedSearchDao advancedSearchDao;%0D%0A%09protected AdvancedSearchCommand cmd;%0D%0A%09protected BindException bindException;%0D%0A%09%0D%0A%09protected void setUp() throws Exception %7B%0D%0A%09%09super.setUp();%0D%0A%09%09controller = new ExportSearchResultsController();%0D%0A%09%09searchDao = registerDaoMockFor(SearchDao.class);%0D%0A%09%09advancedSearchUi = controller.getAdvancedSearchUi();%0D%0A%09%09advancedSearchDao = registerMockFor(AdvancedSearchDao.class);%0D%0A%09%09cmd = registerMockFor(AdvancedSearchCommand.class);%0D%0A%09%09bindException = registerMockFor(BindException.class);%0D%0A%09%09List%3CViewColumn%3E viewColumnsList = new ArrayList%3CViewColumn%3E();%0D%0A%09%09ViewColumn col1 = new ViewColumn();%0D%0A%09%09col1.setColumnTitle(%22Short Title%22);%0D%0A%09%09col1.setTableTitle(%22Studies%22);%0D%0A%09%09col1.setColumnAttribute(%22shortTitleText%22);%0D%0A%09%09viewColumnsList.add(col1);%0D%0A%09%09session.setAttribute(%22resultsViewColumnList%22, viewColumnsList);%0D%0A%09%09%0D%0A%09%09List%3CAdvancedSearchRow%3E searchRowList = new ArrayList%3CAdvancedSearchRow%3E();%0D%0A%09%09AdvancedSearchRow row1 = new AdvancedSearchRow();%0D%0A%09%09List%3CAdvancedSearchColumn%3E searchColmnList = new ArrayList%3CAdvancedSearchColumn%3E();%0D%0A%09%09row1.setColumnList(searchColmnList);%0D%0A%09%09searchRowList.add(row1);%0D%0A%09%09session.setAttribute(%22searchResultsRowList%22, searchRowList);%0D%0A%09%09%0D%0A%09%7D%0D%0A%09%0D%0A%09public void testConstructor()%7B%0D%0A%09%09assertNotNull(advancedSearchUi);%0D%0A%09%7D%0D%0A%09%0D%0A%09public void testHandle() throws Exception%7B%0D%0A%09%09%09controller.handle(request, response, cmd, bindException);%0D%0A%09%09%09String fileName = System.getProperty(%22java.io.tmpdir%22) + File.separator  + ExportSearchResultsController.getXlsSearchResultsFilename();%0D%0A%09%09%09File file = new File(fileName);%0D%0A%09%09%09assertTrue(file.exists());%0D%0A%09%09%09%0D%0A%09%7D%0D%0A%09%0D%0A%7D

test cases coverage