KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > util > TestList2d


1 package org.apache.poi.util;
2
3 import junit.framework.TestCase;
4
5 /**
6  * @version $Id: TestList2d.java,v 1.1 2004/04/18 13:02:48 glens Exp $
7  */

8 public class TestList2d
9         extends TestCase
10 {
11     public void testAccess()
12             throws Exception JavaDoc
13     {
14         Object JavaDoc objectA = new Object JavaDoc();
15         Object JavaDoc objectB = new Object JavaDoc();
16
17         List2d array = new List2d();
18         assertNull( array.get( 0, 0 ) );
19         assertNull( array.get( 1, 1 ) );
20         assertNull( array.get( 100, 100 ) );
21         array.set( 100, 100, objectA );
22         assertSame( objectA, array.get( 100, 100 ) );
23         assertNull( array.get( 0, 0 ) );
24         array.set( 0, 0, objectB );
25         assertSame( objectB, array.get( 0, 0 ) );
26
27         try
28         {
29             array.get( -1, -1 );
30             fail();
31         }
32         catch ( ArrayIndexOutOfBoundsException JavaDoc e )
33         {
34             // pass
35
}
36     }
37 }
38
Popular Tags