Revision 2255
Added by Duane Costa almost 20 years ago
HarvestSiteScheduleTest.java | ||
---|---|---|
37 | 37 |
import junit.framework.TestSuite; |
38 | 38 |
|
39 | 39 |
/** |
40 |
* Test HarvestSiteSchedule code using JUnit. |
|
40 |
* Tests HarvestSiteSchedule code using JUnit.
|
|
41 | 41 |
* |
42 | 42 |
* @author costa |
43 | 43 |
*/ |
... | ... | |
48 | 48 |
private HarvestSiteSchedule harvestSiteSchedulePast; // past date next harvest |
49 | 49 |
|
50 | 50 |
|
51 |
/** |
|
52 |
* Constructor for this test. |
|
53 |
* |
|
54 |
* @param name name of the test case |
|
55 |
*/ |
|
51 | 56 |
public HarvestSiteScheduleTest(String name) { |
52 | 57 |
super(name); |
53 | 58 |
} |
54 | 59 |
|
55 |
|
|
60 |
|
|
61 |
/** |
|
62 |
* Sets up the HarvestSiteScheduleTest by creating a pair of |
|
63 |
* HarvestSiteSchedule objects. The harvestSiteScheduleFuture object |
|
64 |
* is used for a site with a future date of next harvest (not due for |
|
65 |
* harvest now), while the harvestSiteSchedulePast object is used for a site |
|
66 |
* with a past date of next harvest (is due for harvest now). |
|
67 |
*/ |
|
56 | 68 |
protected void setUp() { |
57 | 69 |
String contactEmail = "jdoe@institution.edu"; |
58 | 70 |
String dateLastHarvest = "2004-04-01 00:00:00.0"; |
... | ... | |
100 | 112 |
|
101 | 113 |
} |
102 | 114 |
|
103 |
|
|
115 |
|
|
116 |
/** |
|
117 |
* Closes the database connection after the test completes. |
|
118 |
*/ |
|
104 | 119 |
protected void tearDown() { |
105 | 120 |
harvester.closeConnection(); |
106 | 121 |
} |
107 | 122 |
|
108 |
|
|
123 |
|
|
124 |
/** |
|
125 |
* Tests the dueForHarvest() method in the case where a site is not due for |
|
126 |
* a harvest. |
|
127 |
*/ |
|
109 | 128 |
public void testDueForHarvestFalse() { |
110 | 129 |
boolean dueForHarvest; |
111 | 130 |
|
... | ... | |
113 | 132 |
assertTrue(dueForHarvest == false); |
114 | 133 |
} |
115 | 134 |
|
116 |
|
|
135 |
|
|
136 |
/** |
|
137 |
* Tests the dueForHarvest() method in the case where a site is due for |
|
138 |
* a harvest. |
|
139 |
*/ |
|
140 |
public void testDueForHarvestTrue() { |
|
141 |
boolean dueForHarvest; |
|
142 |
|
|
143 |
dueForHarvest = harvestSiteSchedulePast.dueForHarvest(); |
|
144 |
assertTrue(dueForHarvest == true); |
|
145 |
} |
|
146 |
|
|
147 |
|
|
148 |
/** |
|
149 |
* Tests the parseHarvestList() method. |
|
150 |
*/ |
|
117 | 151 |
public void testParseHarvestList() { |
118 | 152 |
boolean success = false; |
119 | 153 |
String schemaLocation = |
... | ... | |
138 | 172 |
harvestSiteScheduleFuture.printOutput(System.out); |
139 | 173 |
} |
140 | 174 |
|
141 |
|
|
142 |
public void testDueForHarvestTrue() { |
|
143 |
boolean dueForHarvest; |
|
144 |
|
|
145 |
dueForHarvest = harvestSiteSchedulePast.dueForHarvest(); |
|
146 |
assertTrue(dueForHarvest == true); |
|
147 |
} |
|
148 | 175 |
|
149 |
|
|
150 | 176 |
/** |
151 |
* Test that the harvesterDocument object was created successfully. |
|
177 |
* Tests that the harvesterDocument object was created successfully.
|
|
152 | 178 |
*/ |
153 | 179 |
public void testHarvestSiteScheduleObject() { |
154 | 180 |
assertTrue(harvestSiteScheduleFuture != null); |
Also available in: Unified diff
Add additional comments to the test cases.