Coverage details for umich.cac.pbs.test.QueueRecordTest

LineHitsSource
1 package umich.cac.pbs.test;
2  
3 import java.util.logging.Level;
4 import java.util.logging.Logger;
5  
6 import junit.framework.Test;
7 import junit.framework.TestCase;
8 import junit.framework.TestSuite;
9 import umich.cac.pbs.QueueRecord;
10 import umich.cac.util.FileUtil;
11  
12 /**
13  * Tests for QueueRecord class.
14  *
15  * @author rmach@umich.edu
16  * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/pbs/test/QueueRecordTest.java,v 1.4 2003/10/21 19:08:00 rodmach Exp $
17  */
18  
19 public class QueueRecordTest extends TestCase {
20  
21     /**
22      * Logger
23      */
24  
256    private Logger logger = Logger.getLogger(QueueRecordTest.class.getName());
26  
27     /**
28      * The new line seperator for this system
29      */
30  
313    private String nl = System.getProperty("line.separator");
32  
33     /**
34      * Constructor
35      *
36      * @param testName
37      * name of test suite
38      */
39  
40     public QueueRecordTest(java.lang.String testName) {
41  
423        super(testName);
43  
443    }
45  
46     /**
47      * Main - for running stand-alone test
48      *
49      * @param args
50      * command line arguments
51      */
52  
53     public static void main(java.lang.String[] args) {
54  
550        junit.textui.TestRunner.run(suite());
56  
570    }
58  
59     /**
60      * Return a new test suite
61      *
62      * @return a new test suite
63      */
64  
65     public static Test suite() {
66  
673        TestSuite suite = new TestSuite(QueueRecordTest.class);
68  
693        return suite;
70     }
71  
72     /**
73      * Test that QueueRecord returns the correct XML given a example Q record
74      */
75  
76     public void testQueueXML() {
77  
783        String expectedString = FileUtil.getFile("testcases/qrecord.xml");
793        String inputString = FileUtil.getFile("testcases/qrecord.txt");
80         
81         //Must do split to test processRecord
823        String[] fields = inputString.split(";");
833        QueueRecord queueRecord = new QueueRecord();
84  
853        String processedResults = queueRecord.processRecord(fields);
86  
873        if (logger.isLoggable(Level.INFO)) {
883            StringBuffer outputBuffer = new StringBuffer();
893            outputBuffer.append(nl);
903            outputBuffer.append("CALCULATED");
913            outputBuffer.append(nl);
923            outputBuffer.append(processedResults);
933            outputBuffer.append(nl);
943            outputBuffer.append("EXPECTED");
953            outputBuffer.append(nl);
963            outputBuffer.append(expectedString);
973            outputBuffer.append(nl);
98  
99             //Use system.out because logger buffers, and mixes with junit out
100             // on error
101  
1023            System.out.println(outputBuffer.toString());
103  
104         }
105  
1063        assertTrue(expectedString.equals(processedResults));
107  
1083    }
109  
110 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.