| 1 |
package org.jfree.report; |
| 2 |
|
| 3 |
import javax.swing.table.DefaultTableModel; |
| 4 |
|
| 5 |
/** |
| 6 |
* Creation-Date: 10.06.2007, 17:13:33 |
| 7 |
* |
| 8 |
* @author Thomas Morgner |
| 9 |
*/ |
| 10 |
public class TableReportDataTest |
| 11 |
{ |
| 12 |
public void testSingleLineData() |
| 13 |
throws ReportDataFactoryException, DataSourceException |
| 14 |
{ |
| 15 |
final TableReportDataFactory factory = new TableReportDataFactory(); |
| 16 |
factory.addTable("default", new DefaultTableModel(1, 1)); |
| 17 |
|
| 18 |
final ReportData reportData = factory.queryData("default", null); |
| 19 |
if (reportData.isReadable()) |
| 20 |
{ |
| 21 |
throw new IllegalStateException(); |
| 22 |
} |
| 23 |
if (reportData.isAdvanceable() == false) |
| 24 |
{ |
| 25 |
throw new IllegalStateException(); |
| 26 |
} |
| 27 |
|
| 28 |
final boolean b = reportData.next(); |
| 29 |
if (b == false) |
| 30 |
{ |
| 31 |
throw new IllegalStateException(); |
| 32 |
} |
| 33 |
|
| 34 |
if (reportData.isReadable() == false) |
| 35 |
{ |
| 36 |
throw new IllegalStateException(); |
| 37 |
} |
| 38 |
if (reportData.isAdvanceable()) |
| 39 |
{ |
| 40 |
throw new IllegalStateException(); |
| 41 |
} |
| 42 |
|
| 43 |
if (reportData.next()) |
| 44 |
{ |
| 45 |
throw new IllegalStateException(); |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
public void testEmptyData() |
| 50 |
throws ReportDataFactoryException, DataSourceException |
| 51 |
{ |
| 52 |
final TableReportDataFactory factory = new TableReportDataFactory(); |
| 53 |
factory.addTable("default", new DefaultTableModel(0, 0)); |
| 54 |
|
| 55 |
final ReportData reportData = factory.queryData("default", null); |
| 56 |
if (reportData.isReadable()) |
| 57 |
{ |
| 58 |
throw new IllegalStateException(); |
| 59 |
} |
| 60 |
if (reportData.isAdvanceable()) |
| 61 |
{ |
| 62 |
throw new IllegalStateException(); |
| 63 |
} |
| 64 |
|
| 65 |
final boolean b = reportData.next(); |
| 66 |
if (b) |
| 67 |
{ |
| 68 |
throw new IllegalStateException(); |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
public static void main(String[] args) |
| 73 |
throws ReportDataFactoryException, DataSourceException |
| 74 |
{ |
| 75 |
new TableReportDataTest().testEmptyData(); |
| 76 |
} |
| 77 |
} |