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

LineHitsSource
1 package umich.cac.pbs.test;
2  
3 import java.util.logging.Logger;
4  
5 import junit.framework.Test;
6 import junit.framework.TestCase;
7 import junit.framework.TestSuite;
8 import umich.cac.pbs.DeleteRecord;
9 import umich.cac.pbs.ExecutionRecord;
10 import umich.cac.pbs.PbsRecordParser;
11 import umich.cac.pbs.QueueRecord;
12 import umich.cac.pbs.RecordFactory;
13 import umich.cac.pbs.RecordType;
14 import umich.cac.pbs.StartRecord;
15  
16 /**
17  * Tests for RecordFactory class.
18  *
19  * @author rmach@umich.edu
20  * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/pbs/test/RecordFactoryTest.java,v 1.3 2003/10/21 19:08:00 rodmach Exp $
21  */
22 public class RecordFactoryTest extends TestCase {
23  
24     /** Logger */
2518    private Logger logger = Logger.getLogger(RecordFactoryTest.class.getName());
26  
27     /** Record factory for testing */
2815    RecordFactory recordFactory = RecordFactory.getInstance();
29  
30     /**
31      * Constructor
32      *
33      * @param testName
34      * name of test suite
35      */
36     public RecordFactoryTest(java.lang.String testName) {
3715        super(testName);
3815    }
39  
40     /**
41      * Main - for running stand-alone test
42      *
43      * @param args
44      * command line arguments
45      */
46     public static void main(java.lang.String[] args) {
470        junit.textui.TestRunner.run(suite());
480    }
49  
50     /**
51      * Return a new test suite
52      *
53      * @return a new test suite
54      */
55     public static Test suite() {
563        TestSuite suite = new TestSuite(RecordFactoryTest.class);
57  
583        return suite;
59     }
60  
61     /** Test the correct record parser is returned for Queue records */
62     public void testQueueParser() {
633        PbsRecordParser parser =
64             recordFactory.getRecordParser(RecordType.QUEUE_RECORD);
653        assertTrue(parser instanceof QueueRecord);
663    }
67     /** Test the correct record parser is returned for Execution records */
68     public void testExecutionParser() {
693        PbsRecordParser parser =
70             recordFactory.getRecordParser(RecordType.EXECUTION_RECORD);
713        assertTrue(parser instanceof ExecutionRecord);
723    }
73     /** Test the correct record parser is returned for Start records */
74     public void testStartParser() {
753        PbsRecordParser parser =
76             recordFactory.getRecordParser(RecordType.START_RECORD);
773        assertTrue(parser instanceof StartRecord);
783    }
79  
80     /** Test the correct record parser is returned for Delete records */
81     public void testDeleteParser() {
823        PbsRecordParser parser =
83             recordFactory.getRecordParser(RecordType.DELETE_RECORD);
843        assertTrue(parser instanceof DeleteRecord);
853    }
86  
87     /** Test that null is returned for an unknown record */
88     public void testUnknownRecordParser() {
893        PbsRecordParser parser =
90             recordFactory.getRecordParser(new RecordType("BOGUS"));
913        assertTrue(parser == null);
923    }
93  
94 }

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.