View Javadoc

1   /*
2    * 
3    * 
4    */
5   package oscon2006.common;
6   
7   import junit.framework.TestCase;
8   import java.sql.*;
9   import java.io.*;
10  import javax.swing.table.TableModel;
11  
12  public class XlsBuilderTest extends TestCase
13  {
14  	public void testResultSet() throws Exception
15  	{
16  		
17  		ResultSet rs = TestUtil.createResultSet(50);
18  		
19  		final String filename = "resultset.xls";
20  		
21  		File f = new File(filename);
22  		
23  		f.delete();
24  		
25  		XlsBuilder b = new XlsBuilder();
26  		b.setData(rs);
27  		b.build(filename);
28  		
29  		assertTrue(f.exists());
30  		
31  	}
32  	
33  	public void testTableModel() throws Exception
34  	{
35  		
36  		TableModel model = TestUtil.createTableModel(50);
37  		
38  		final String filename = "tablemodel.xls";
39  		
40  		File f = new File(filename);
41  		f.delete();
42  		XlsBuilder b = new XlsBuilder();
43  		b.setData(model);
44  		b.build(filename);
45  		
46  		assertTrue(f.exists());
47  		
48  	}
49  }