Revision 2255
Added by Duane Costa almost 20 years ago
HarvestLogTest.java | ||
---|---|---|
43 | 43 |
import junit.framework.TestSuite; |
44 | 44 |
|
45 | 45 |
/** |
46 |
* Test HarvestLog code using JUnit. |
|
46 |
* Tests HarvestLog code using JUnit.
|
|
47 | 47 |
* |
48 | 48 |
* @author costa |
49 | 49 |
*/ |
... | ... | |
57 | 57 |
private HarvestSiteSchedule harvestSiteSchedule; |
58 | 58 |
|
59 | 59 |
|
60 |
/** |
|
61 |
* Constructor for this test. |
|
62 |
* |
|
63 |
* @param name name of the test case |
|
64 |
*/ |
|
60 | 65 |
public HarvestLogTest(String name) { |
61 | 66 |
super(name); |
62 | 67 |
} |
63 | 68 |
|
64 |
|
|
69 |
|
|
70 |
/** |
|
71 |
* Sets up the test by instantiating a HarvestSiteSchedule, HarvestDocument, |
|
72 |
* and two HarvestLog objects. The harvestLogShallow is a HarvestLog that |
|
73 |
* does not have an associated HarvestDetailLog. The harvestLogDeep is a |
|
74 |
* HarvestLog that does have an associated HarvestDetailLog. |
|
75 |
*/ |
|
65 | 76 |
protected void setUp() { |
66 | 77 |
String contactEmail = "jdoe@institution.edu"; |
67 | 78 |
String dateLastHarvest = "2004-04-01 00:00:00.0"; |
... | ... | |
129 | 140 |
harvestDocument, errorMessage); |
130 | 141 |
} |
131 | 142 |
|
132 |
|
|
143 |
|
|
144 |
/** |
|
145 |
* Closes the database connection after the test completes. |
|
146 |
*/ |
|
133 | 147 |
protected void tearDown() { |
134 | 148 |
harvester.closeConnection(); |
135 | 149 |
} |
136 | 150 |
|
137 |
|
|
151 |
|
|
152 |
/** |
|
153 |
* Tests the getCodeLevelValue() method by comparing the value returned for |
|
154 |
* "error" (lowest level) to the value returned for "debug" (highest level). |
|
155 |
*/ |
|
138 | 156 |
public void testGetCodeLevelValue() { |
139 | 157 |
int lowLevel = harvestLogShallow.getCodeLevelValue("error"); |
140 | 158 |
int highLevel = harvestLogShallow.getCodeLevelValue("debug"); |
... | ... | |
142 | 160 |
assertTrue(lowLevel < highLevel); |
143 | 161 |
} |
144 | 162 |
|
145 |
|
|
163 |
|
|
164 |
/** |
|
165 |
* Tests the getExplanation() method. Check that a harvest operation code is |
|
166 |
* associated with an appropriate explanation string. |
|
167 |
*/ |
|
146 | 168 |
public void testGetExplanation() { |
147 | 169 |
String harvestOperationCode = "HarvesterStartup"; |
148 | 170 |
String explanation; |
... | ... | |
151 | 173 |
assertTrue(explanation.equals("Harvester start up")); |
152 | 174 |
} |
153 | 175 |
|
154 |
|
|
176 |
|
|
177 |
/** |
|
178 |
* Tests the getHarvestOperationCodeLevel() method. Check that the method |
|
179 |
* returns an appropriate code level for a given harvest operation code. |
|
180 |
*/ |
|
155 | 181 |
public void testGetHarvestOperationCodeLevel() { |
156 | 182 |
String harvestOperationCode = "HarvesterStartup"; |
157 | 183 |
String harvestOperationCodeLevel; |
... | ... | |
163 | 189 |
|
164 | 190 |
|
165 | 191 |
/** |
166 |
* Test the construction of HarvestLog object, and a HarvestLog object |
|
192 |
* Tests the construction of HarvestLog object, and a HarvestLog object
|
|
167 | 193 |
* that contains a HarvestDetailLog object. |
168 | 194 |
*/ |
169 | 195 |
public void testHarvestLogObject() { |
Also available in: Unified diff
Add additional comments to the test cases.