Line | Hits | Source |
---|---|---|
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 */ | |
21 | 6 | private Logger logger = Logger.getLogger(DeleteRecordTest.class.getName()); |
22 | ||
23 | /** The new line seperator for this system */ | |
24 | 3 | 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) { | |
33 | 3 | super(testName); |
34 | 3 | } |
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) { | |
43 | 0 | junit.textui.TestRunner.run(suite()); |
44 | 0 | } |
45 | ||
46 | /** | |
47 | * Return a new test suite | |
48 | * | |
49 | * @return a new test suite | |
50 | */ | |
51 | public static Test suite() { | |
52 | 3 | TestSuite suite = new TestSuite(DeleteRecordTest.class); |
53 | ||
54 | 3 | return suite; |
55 | } | |
56 | ||
57 | /** | |
58 | * Test that DeleteRecord returns the correct XML given a example D record | |
59 | */ | |
60 | public void testDeleteRecordXML() { | |
61 | 3 | String expectedString = FileUtil.getFile("testcases/drecord.xml"); |
62 | 3 | String inputString = FileUtil.getFile("testcases/drecord.txt"); |
63 | ||
64 | //Must do split to test processRecord | |
65 | 3 | String[] fields = inputString.split(";"); |
66 | ||
67 | 3 | DeleteRecord deleteRecord = new DeleteRecord(); |
68 | 3 | String processedResults = deleteRecord.processRecord(fields); |
69 | ||
70 | 3 | if (logger.isLoggable(Level.INFO)) { |
71 | 3 | StringBuffer outputBuffer = new StringBuffer(); |
72 | 3 | outputBuffer.append(nl); |
73 | 3 | outputBuffer.append("CALCULATED"); |
74 | 3 | outputBuffer.append(nl); |
75 | 3 | outputBuffer.append(processedResults); |
76 | 3 | outputBuffer.append(nl); |
77 | 3 | outputBuffer.append("EXPECTED"); |
78 | 3 | outputBuffer.append(nl); |
79 | 3 | outputBuffer.append(expectedString); |
80 | 3 | outputBuffer.append(nl); |
81 | //Use system.out because logger buffers, and mixes with junit out | |
82 | // on error | |
83 | 3 | System.out.println(outputBuffer.toString()); |
84 | } | |
85 | ||
86 | 3 | assertTrue(expectedString.equals(processedResults)); |
87 | ||
88 | 3 | } |
89 | ||
90 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |