01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.tx;
05:
06: import junit.framework.TestCase;
07:
08: public class WaitInvocationTest extends TestCase {
09:
10: public void testCstrs() throws Exception {
11: WaitInvocation wait0 = new WaitInvocation();
12: assertEquals(WaitInvocation.NO_ARGS, wait0.getSignature());
13:
14: WaitInvocation wait1 = new WaitInvocation(1);
15: assertEquals(WaitInvocation.LONG, wait1.getSignature());
16: assertEquals(1, wait1.getMillis());
17:
18: WaitInvocation wait2 = new WaitInvocation(2, 3);
19: assertEquals(WaitInvocation.LONG_INT, wait2.getSignature());
20: assertEquals(2, wait2.getMillis());
21: assertEquals(3, wait2.getNanos());
22:
23: new WaitInvocation(0);
24: new WaitInvocation(1);
25: new WaitInvocation(Long.MAX_VALUE);
26:
27: try {
28: new WaitInvocation(-1);
29: fail("no exception thrown");
30: } catch (IllegalArgumentException iae) {
31: // expected
32: }
33:
34: new WaitInvocation(0, 0);
35: new WaitInvocation(1, 0);
36: new WaitInvocation(Long.MAX_VALUE, 0);
37: new WaitInvocation(Long.MAX_VALUE, Integer.MAX_VALUE);
38:
39: try {
40: new WaitInvocation(-1, 0);
41: fail("no exception thrown");
42: } catch (IllegalArgumentException iae) {
43: // expected
44: }
45:
46: try {
47: new WaitInvocation(-1, -1);
48: fail("no exception thrown");
49: } catch (IllegalArgumentException iae) {
50: // expected
51: }
52:
53: try {
54: new WaitInvocation(0, -1);
55: fail("no exception thrown");
56: } catch (IllegalArgumentException iae) {
57: // expected
58: }
59: }
60:
61: }
|