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

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.StartRecord;
10 import umich.cac.util.FileUtil;
11  
12 /**
13  * Tests for StartRecord class.
14  *
15  * @author rmach@umich.edu
16  * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/pbs/test/StartRecordTest.java,v 1.4 2003/10/21 19:08:00 rodmach Exp $
17  */
18 public class StartRecordTest extends TestCase {
19  
20  
21     /** Logger */
226        private Logger logger = Logger.getLogger(StartRecordTest.class.getName());
23     
24     /** The new line seperator for this system */
253    private String nl = System.getProperty("line.separator");
26  
27     
28     /**
29      * Constructor
30      *
31      * @param testName name of test suite
32      */
33     public StartRecordTest(java.lang.String testName) {
343        super(testName);
353    }
36  
37  
38     /**
39      * Main - for running stand-alone test
40      *
41      * @param args command line arguments
42      */
43     public static void main(java.lang.String[] args) {
440        junit.textui.TestRunner.run(suite());
450    }
46  
47  
48     /**
49      * Return a new test suite
50      *
51      * @return a new test suite
52      */
53     public static Test suite() {
543        TestSuite suite = new TestSuite(StartRecordTest.class);
55  
563        return suite;
57     }
58  
59  
60     /**
61      * Test that StartRecord returns the correct XML given a example D record
62      */
63      public void testStartXML() {
643       String expectedString = FileUtil.getFile("testcases/srecord.xml");
653       String inputString = FileUtil.getFile("testcases/srecord.txt");
66        
67        //Must do split to test processRecord
683       String[] fields = inputString.split(";");
69  
703       StartRecord startRecord = new StartRecord();
713       String processedResults = startRecord.processRecord(fields);
72        
73        
743       if (logger.isLoggable(Level.INFO)) {
753         StringBuffer outputBuffer = new StringBuffer();
763         outputBuffer.append(nl);
773         outputBuffer.append("CALCULATED");
783         outputBuffer.append(nl);
793         outputBuffer.append(processedResults);
803         outputBuffer.append(nl);
813         outputBuffer.append("EXPECTED");
823         outputBuffer.append(nl);
833         outputBuffer.append(expectedString);
843         outputBuffer.append(nl);
85          //Use system.out because logger buffers, and mixes with junit out on error
863         System.out.println(outputBuffer.toString());
87        }
88        
893       assertTrue(expectedString.equals(processedResults));
90          
913     }
92  
93     
94 }
95  

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.