Line | Hits | Source |
---|---|---|
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 */ | |
25 | 18 | private Logger logger = Logger.getLogger(RecordFactoryTest.class.getName()); |
26 | ||
27 | /** Record factory for testing */ | |
28 | 15 | 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) { | |
37 | 15 | super(testName); |
38 | 15 | } |
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) { | |
47 | 0 | junit.textui.TestRunner.run(suite()); |
48 | 0 | } |
49 | ||
50 | /** | |
51 | * Return a new test suite | |
52 | * | |
53 | * @return a new test suite | |
54 | */ | |
55 | public static Test suite() { | |
56 | 3 | TestSuite suite = new TestSuite(RecordFactoryTest.class); |
57 | ||
58 | 3 | return suite; |
59 | } | |
60 | ||
61 | /** Test the correct record parser is returned for Queue records */ | |
62 | public void testQueueParser() { | |
63 | 3 | PbsRecordParser parser = |
64 | recordFactory.getRecordParser(RecordType.QUEUE_RECORD); | |
65 | 3 | assertTrue(parser instanceof QueueRecord); |
66 | 3 | } |
67 | /** Test the correct record parser is returned for Execution records */ | |
68 | public void testExecutionParser() { | |
69 | 3 | PbsRecordParser parser = |
70 | recordFactory.getRecordParser(RecordType.EXECUTION_RECORD); | |
71 | 3 | assertTrue(parser instanceof ExecutionRecord); |
72 | 3 | } |
73 | /** Test the correct record parser is returned for Start records */ | |
74 | public void testStartParser() { | |
75 | 3 | PbsRecordParser parser = |
76 | recordFactory.getRecordParser(RecordType.START_RECORD); | |
77 | 3 | assertTrue(parser instanceof StartRecord); |
78 | 3 | } |
79 | ||
80 | /** Test the correct record parser is returned for Delete records */ | |
81 | public void testDeleteParser() { | |
82 | 3 | PbsRecordParser parser = |
83 | recordFactory.getRecordParser(RecordType.DELETE_RECORD); | |
84 | 3 | assertTrue(parser instanceof DeleteRecord); |
85 | 3 | } |
86 | ||
87 | /** Test that null is returned for an unknown record */ | |
88 | public void testUnknownRecordParser() { | |
89 | 3 | PbsRecordParser parser = |
90 | recordFactory.getRecordParser(new RecordType("BOGUS")); | |
91 | 3 | assertTrue(parser == null); |
92 | 3 | } |
93 | ||
94 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |