001: package org.springunit.examples;
002:
003: import org.springunit.framework.SpringUnitContext;
004: import org.springunit.framework.SpringUnitTest;
005:
006: public class CompositeTimeSpringUnitTest extends SpringUnitTest {
007:
008: public SpringUnitContext getCompositeTimeSpringUnitTest() {
009: return this .compositeTimeSpringUnitTest;
010: }
011:
012: public void setCompositeTimeSpringUnitTest(
013: SpringUnitContext compositeTimeSpringUnitTest) {
014: this .compositeTimeSpringUnitTest = compositeTimeSpringUnitTest;
015: }
016:
017: public void testIncrementHours000000000() throws Exception {
018: runIncrementHours();
019: }
020:
021: public void testIncrementHours235959999() throws Exception {
022: runIncrementHours();
023: }
024:
025: public void testIncrementMinutes000000000() throws Exception {
026: runIncrementMinutes();
027: }
028:
029: public void testIncrementMinutes235959999() throws Exception {
030: runIncrementMinutes();
031: }
032:
033: public void testIncrementMinutes225959999() throws Exception {
034: runIncrementMinutes();
035: }
036:
037: public void testIncrementSeconds000000000() throws Exception {
038: runIncrementSeconds();
039: }
040:
041: public void testIncrementSeconds235959999() throws Exception {
042: runIncrementSeconds();
043: }
044:
045: public void testIncrementSeconds235859999() throws Exception {
046: runIncrementSeconds();
047: }
048:
049: public void testIncrementMillis000000000() throws Exception {
050: runIncrementMillis();
051: }
052:
053: public void testIncrementMillis235959999() throws Exception {
054: runIncrementMillis();
055: }
056:
057: public void testIncrementMillis235958999() throws Exception {
058: runIncrementMillis();
059: }
060:
061: public void testDecrementHours000000000() throws Exception {
062: runDecrementHours();
063: }
064:
065: public void testDecrementHours235959999() throws Exception {
066: runDecrementHours();
067: }
068:
069: public void testDecrementHours010000000() throws Exception {
070: runDecrementHours();
071: }
072:
073: public void testDecrementMinutes000000000() throws Exception {
074: runDecrementMinutes();
075: }
076:
077: public void testDecrementMinutes235959999() throws Exception {
078: runDecrementMinutes();
079: }
080:
081: public void testDecrementMinutes010000000() throws Exception {
082: runDecrementMinutes();
083: }
084:
085: public void testDecrementSeconds000000000() throws Exception {
086: runDecrementSeconds();
087: }
088:
089: public void testDecrementSeconds235959999() throws Exception {
090: runDecrementSeconds();
091: }
092:
093: public void testDecrementSeconds000100000() throws Exception {
094: runDecrementSeconds();
095: }
096:
097: public void testDecrementMillis000000000() throws Exception {
098: runDecrementMillis();
099: }
100:
101: public void testDecrementMillis235959999() throws Exception {
102: runDecrementMillis();
103: }
104:
105: public void testDecrementMillis000001000() throws Exception {
106: runDecrementMillis();
107: }
108:
109: protected void runIncrementHours() throws Exception {
110: CompositeTime subject = getObject("subject");
111: CompositeTime expected = getObject("expected");
112: Exception expectedException = getObject("expectedException");
113: boolean expectedOverflow = getObject("expectedOverflow");
114: try {
115: boolean overflow = subject.incrementHours();
116: if (expectedException != null) {
117: fail("Exception not thrown");
118: }
119: assertEquals(expected, subject);
120: assertEquals(expectedOverflow, overflow);
121: } catch (Exception ex) {
122: if (expectedException == null) {
123: throw ex;
124: } else {
125: assertTrue(expectedException.getClass()
126: .isAssignableFrom(ex.getClass()));
127: }
128: }
129: }
130:
131: protected void runIncrementMinutes() throws Exception {
132: CompositeTime subject = getObject("subject");
133: CompositeTime expected = getObject("expected");
134: Exception expectedException = getObject("expectedException");
135: boolean expectedOverflow = getObject("expectedOverflow");
136: try {
137: boolean overflow = subject.incrementMinutes();
138: if (expectedException != null) {
139: fail("Exception not thrown");
140: }
141: assertEquals(expected, subject);
142: assertEquals(expectedOverflow, overflow);
143: } catch (Exception ex) {
144: if (expectedException == null) {
145: throw ex;
146: } else {
147: assertTrue(expectedException.getClass()
148: .isAssignableFrom(ex.getClass()));
149: }
150: }
151: }
152:
153: protected void runIncrementSeconds() throws Exception {
154: CompositeTime subject = getObject("subject");
155: CompositeTime expected = getObject("expected");
156: Exception expectedException = getObject("expectedException");
157: boolean expectedOverflow = getObject("expectedOverflow");
158: try {
159: boolean overflow = subject.incrementSeconds();
160: if (expectedException != null) {
161: fail("Exception not thrown");
162: }
163: assertEquals(expected, subject);
164: assertEquals(expectedOverflow, overflow);
165: } catch (Exception ex) {
166: if (expectedException == null) {
167: throw ex;
168: } else {
169: assertTrue(expectedException.getClass()
170: .isAssignableFrom(ex.getClass()));
171: }
172: }
173: }
174:
175: protected void runIncrementMillis() throws Exception {
176: CompositeTime subject = getObject("subject");
177: CompositeTime expected = getObject("expected");
178: Exception expectedException = getObject("expectedException");
179: boolean expectedOverflow = getObject("expectedOverflow");
180: try {
181: boolean overflow = subject.incrementMillis();
182: if (expectedException != null) {
183: fail("Exception not thrown");
184: }
185: assertEquals(expected, subject);
186: assertEquals(expectedOverflow, overflow);
187: } catch (Exception ex) {
188: if (expectedException == null) {
189: throw ex;
190: } else {
191: assertTrue(expectedException.getClass()
192: .isAssignableFrom(ex.getClass()));
193: }
194: }
195: }
196:
197: protected void runDecrementHours() throws Exception {
198: CompositeTime subject = getObject("subject");
199: CompositeTime expected = getObject("expected");
200: Exception expectedException = getObject("expectedException");
201: boolean expectedUnderflow = getObject("expectedUnderflow");
202: try {
203: boolean underflow = subject.decrementHours();
204: if (expectedException != null) {
205: fail("Exception not thrown");
206: }
207: assertEquals(expected, subject);
208: assertEquals(expectedUnderflow, underflow);
209: } catch (Exception ex) {
210: if (expectedException == null) {
211: throw ex;
212: } else {
213: assertTrue(expectedException.getClass()
214: .isAssignableFrom(ex.getClass()));
215: }
216: }
217: }
218:
219: protected void runDecrementMinutes() throws Exception {
220: CompositeTime subject = getObject("subject");
221: CompositeTime expected = getObject("expected");
222: Exception expectedException = getObject("expectedException");
223: boolean expectedUnderflow = getObject("expectedUnderflow");
224: try {
225: boolean underflow = subject.decrementMinutes();
226: if (expectedException != null) {
227: fail("Exception not thrown");
228: }
229: assertEquals(expected, subject);
230: assertEquals(expectedUnderflow, underflow);
231: } catch (Exception ex) {
232: if (expectedException == null) {
233: throw ex;
234: } else {
235: assertTrue(expectedException.getClass()
236: .isAssignableFrom(ex.getClass()));
237: }
238: }
239: }
240:
241: protected void runDecrementSeconds() throws Exception {
242: CompositeTime subject = getObject("subject");
243: CompositeTime expected = getObject("expected");
244: Exception expectedException = getObject("expectedException");
245: boolean expectedUnderflow = getObject("expectedUnderflow");
246: try {
247: boolean underflow = subject.decrementSeconds();
248: if (expectedException != null) {
249: fail("Exception not thrown");
250: }
251: assertEquals(expected, subject);
252: assertEquals(expectedUnderflow, underflow);
253: } catch (Exception ex) {
254: if (expectedException == null) {
255: throw ex;
256: } else {
257: assertTrue(expectedException.getClass()
258: .isAssignableFrom(ex.getClass()));
259: }
260: }
261: }
262:
263: protected void runDecrementMillis() throws Exception {
264: CompositeTime subject = getObject("subject");
265: CompositeTime expected = getObject("expected");
266: Exception expectedException = getObject("expectedException");
267: boolean expectedUnderflow = getObject("expectedUnderflow");
268: try {
269: boolean underflow = subject.decrementMillis();
270: if (expectedException != null) {
271: fail("Exception not thrown");
272: }
273: assertEquals(expected, subject);
274: assertEquals(expectedUnderflow, underflow);
275: } catch (Exception ex) {
276: if (expectedException == null) {
277: throw ex;
278: } else {
279: assertTrue(expectedException.getClass()
280: .isAssignableFrom(ex.getClass()));
281: }
282: }
283: }
284:
285: private SpringUnitContext compositeTimeSpringUnitTest;
286:
287: }
|