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

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.DeleteRecord;
10 import umich.cac.util.FileUtil;
11  
12 /**
13  * Tests for DeleteRecord class.
14  *
15  * @author rmach@umich.edu
16  * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/pbs/test/DeleteRecordTest.java,v 1.3 2003/10/21 19:08:00 rodmach Exp $
17  */
18 public class DeleteRecordTest extends TestCase {
19  
20     /** Logger */
216    private Logger logger = Logger.getLogger(DeleteRecordTest.class.getName());
22  
23     /** The new line seperator for this system */
243    private String nl = System.getProperty("line.separator");
25  
26     /**
27      * Constructor
28      *
29      * @param testName
30      * name of test suite
31      */
32     public DeleteRecordTest(java.lang.String testName) {
333        super(testName);
343    }
35  
36     /**
37      * Main - for running stand-alone test
38      *
39      * @param args
40      * command line arguments
41      */
42     public static void main(java.lang.String[] args) {
430        junit.textui.TestRunner.run(suite());
440    }
45  
46     /**
47      * Return a new test suite
48      *
49      * @return a new test suite
50      */
51     public static Test suite() {
523        TestSuite suite = new TestSuite(DeleteRecordTest.class);
53  
543        return suite;
55     }
56  
57     /**
58      * Test that DeleteRecord returns the correct XML given a example D record
59      */
60     public void testDeleteRecordXML() {
613        String expectedString = FileUtil.getFile("testcases/drecord.xml");
623        String inputString = FileUtil.getFile("testcases/drecord.txt");
63  
64         //Must do split to test processRecord
653        String[] fields = inputString.split(";");
66  
673        DeleteRecord deleteRecord = new DeleteRecord();
683        String processedResults = deleteRecord.processRecord(fields);
69  
703        if (logger.isLoggable(Level.INFO)) {
713            StringBuffer outputBuffer = new StringBuffer();
723            outputBuffer.append(nl);
733            outputBuffer.append("CALCULATED");
743            outputBuffer.append(nl);
753            outputBuffer.append(processedResults);
763            outputBuffer.append(nl);
773            outputBuffer.append("EXPECTED");
783            outputBuffer.append(nl);
793            outputBuffer.append(expectedString);
803            outputBuffer.append(nl);
81             //Use system.out because logger buffers, and mixes with junit out
82             // on error
833            System.out.println(outputBuffer.toString());
84         }
85  
863        assertTrue(expectedString.equals(processedResults));
87  
883    }
89  
90 }

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.