package reflection;

import java.util.Arrays;
import org.junit.Test;
import unit.UnitTestRunner;

public class ArrayClassTest {
    
    public static void main(String[] args) {
        UnitTestRunner.run(ArrayClassTest.class);
    }
    
    @Test
    public void primitiveArray() {
        Class<?> c = new int[0].getClass();
        System.out.println(c.getName());
        System.out.println("superclass:" + c.getSuperclass());
        System.out.println(Arrays.toString(c.getInterfaces()));
        System.out.println("fields:" + c.getFields().length);
        System.out.println("methods:" + c.getMethods().length);
        System.out.println("declaredMethods:" + c.getDeclaredMethods().length);
    }
    
}

@@ -30,19 +30,23 @@
 ava.
-util.Arrays
+io.Serializable
 ;%0Aim
@@ -93,16 +93,50 @@
 tRunner;
+%0Aimport static org.junit.Assert.*;
 %0A%0Apublic
@@ -367,35 +367,35 @@
         
-System.out.println(
+assertEquals(%22%5BI%22, 
 c.getNam
@@ -412,42 +412,34 @@
     
-System.out.println(%22super
+assertEquals(Object.
 class
-:%22 +
+,
  c.g
@@ -467,43 +467,79 @@
     
-System.out.println(Arrays.toString(
+assertArrayEquals(new Class%3C?%3E%5B%5D%7BCloneable.class, Serializable.class%7D, 
 c.ge
@@ -552,17 +552,16 @@
 faces())
-)
 ;%0A      
@@ -566,38 +566,23 @@
     
-System.out.println(%22fields:%22 +
+assertEquals(0,
  c.g
@@ -613,111 +613,126 @@
     
-System.out.println(%22methods:%22 + c.getMethods().length);%0A        System.out.println(%22declaredMethods:%22 +
+assertEquals(0, c.getDeclaredFields().length);%0A        assertEquals(9, c.getMethods().length);%0A        assertEquals(0,
  c.g

refactor unit tests