View Javadoc

1   /**
2    * 
3    */
4   package net.sf.madmap;
5   
6   import java.util.ArrayList;
7   
8   import junit.framework.Test;
9   import junit.framework.TestCase;
10  import junit.framework.TestSuite;
11  
12  /**
13   * @author ecaspole
14   *
15   */
16  public class ArrayTest extends TestCase {
17  
18      /**
19       * Create the test case
20       *
21       * @param testName name of the test case
22       */	
23      public ArrayTest( String testName )
24      {
25          super( testName );
26      }
27  
28      /**
29       * @return the suite of tests being tested
30       */
31      public static Test suite()
32      {
33          return new TestSuite( ArrayTest.class );
34      }
35  
36      /**
37       * Rigourous Test :-)
38          public HprofArrayObject( long addr, String type, int trace, 
39              long size, long nelems, long cls_addr, ArrayList elems )
40      */
41      public void testArrayObject()
42      {
43      	String className = "fee.fi.fo.Fum[]";
44      	long objAddr = 0xffffffff;
45      	long clsAddr = 0xeeeeeeee;
46      	int trace = 1;
47      	long arrayLength = 32;
48      	long nElems = 1;
49      	Long dataMemberAddr = new Long( 0xdddddddd );
50      	ArrayList elems = new ArrayList();
51      	HprofClassElement k = new HprofClassElement( clsAddr, className);
52      	elems.add( dataMemberAddr );
53        HprofArrayObject ho = new HprofArrayObject( objAddr, className, trace, arrayLength, nElems, k, elems);
54  
55        assertEquals( ho.class_addr(), k );
56        assertEquals( ho.addr(), objAddr );
57        assertEquals( ho.size(), arrayLength );
58        assertEquals( ho.children_size(), elems.size() );
59        assertNotNull( ho.children() );
60        assertNotNull(k.toString());
61        assertNotNull(ho.toString());
62      }
63  }