KickJava   Java API By Example, From Geeks To Geeks.

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


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

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