package org.appfuse.webapp.action;

import java.io.File;

public class ReportsTest extends BasePageTestCase {
    private Reports bean;

    protected void setUp() throws Exception {    
        super.setUp();
        bean = (Reports) getManagedBean("reports");
        // to use hard coded value in report
        bean.setWebDir(null);
    }
    
    public void testSearch() throws Exception {
        String ctxPath = bean.getServletContext().getRealPath("/");
        
        // ensures resources directory is present
        File f = new File(ctxPath + "/resources");
        f.mkdir();
        
        // generates report
        assertNull(bean.users());
        
        // checks the file is present
        f = new File(ctxPath + "/resources/userList.pdf");
        assertTrue(f.exists());
        
        assertFalse(bean.hasErrors());
    }

}
