KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > tx > WaitInvocationTest


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.tx;
5
6 import junit.framework.TestCase;
7
8 public class WaitInvocationTest extends TestCase {
9
10   public void testCstrs() throws Exception JavaDoc {
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 JavaDoc 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 JavaDoc iae) {
43       // expected
44
}
45
46     try {
47       new WaitInvocation(-1, -1);
48       fail("no exception thrown");
49     } catch (IllegalArgumentException JavaDoc iae) {
50       // expected
51
}
52
53     try {
54       new WaitInvocation(0, -1);
55       fail("no exception thrown");
56     } catch (IllegalArgumentException JavaDoc iae) {
57       // expected
58
}
59   }
60
61 }
Popular Tags