1 package jimm.datavision.test; 2 import jimm.datavision.Report; 3 import jimm.datavision.layout.pdf.PDFLE; 4 import jimm.datavision.source.charsep.CharSepSource; 5 import java.io.*; 6 import junit.framework.TestCase; 7 import junit.framework.TestSuite; 8 import junit.framework.Test; 9 10 15 public class PDFLETest extends TestCase { 16 17 protected static final File EXAMPLE_REPORT = 18 new File(AllTests.testDataFile("charsep.xml")); 19 protected static final String DATA_FILE = 20 AllTests.testDataFile("charsep_data.csv"); 21 protected static final File OUT_FILE = 22 new File(System.getProperty("java.io.tmpdir"), 23 "datavision_pdfle_test_out.txt"); 24 25 protected Report report; 26 protected CharSepSource dataSource; 27 28 public static Test suite() { 29 return new TestSuite(PDFLETest.class); 30 } 31 32 public PDFLETest(String name) { 33 super(name); 34 } 35 36 public void setUp() throws Exception { 37 report = new Report(); 38 39 OUT_FILE.deleteOnExit(); 40 report.setLayoutEngine(new PDFLE(new FileOutputStream(OUT_FILE))); 41 42 report.read(EXAMPLE_REPORT); 43 44 dataSource = (CharSepSource)report.getDataSource(); 45 dataSource.setSepChar(','); 46 dataSource.setInput(DATA_FILE); 47 } 48 49 public void tearDown() { 50 if (OUT_FILE.exists()) 51 OUT_FILE.delete(); 52 } 53 54 public void testNullReportSummary() { 55 report.setName(null); 56 report.setTitle(null); 57 report.setAuthor(null); 58 report.setDescription(null); 59 report.runReport(); 60 } 61 62 public static void main(String [] args) { 63 junit.textui.TestRunner.run(suite()); 64 System.exit(0); 65 } 66 67 } 68 | Popular Tags |