1 package test.utils.cache; 2 3 import junit.framework.Test; 4 import junit.framework.TestCase; 5 import junit.framework.TestSuite; 6 import org.apache.axis.utils.cache.JavaMethod; 7 8 import java.lang.reflect.Method ; 9 10 public class TestJavaMethod extends TestCase 11 { 12 public TestJavaMethod (String name) { 13 super(name); 14 } 15 16 public static Test suite() { 17 return new TestSuite(TestJavaMethod.class); 18 } 19 20 protected void setup() { 21 } 22 23 public void testGetMethodWithVectorMethods() 24 { 25 Class vector = new java.util.Vector ().getClass(); 26 JavaMethod jmAdd = new JavaMethod(vector, "add"); 27 assertNotNull("jmAdd was null", jmAdd); 28 29 Method[] adds = jmAdd.getMethod(); 30 assertEquals("There are not 2 add methods as expected, there are " + adds.length, 2, adds.length); 31 32 for (int i = 0; i < adds.length; ++i) { 33 if (adds[i].getReturnType().equals(boolean.class)) { 34 assertEquals("Unexpected boolean add signature", 35 "public synchronized boolean java.util.Vector.add(java.lang.Object)", 36 adds[i].toString()); 37 } 38 else { 39 assertEquals("Unexpected void add signature", 40 "public void java.util.Vector.add(int,java.lang.Object)", 41 adds[i].toString()); 42 } 43 } 44 } 45 46 public void testGetMethodWithOverloadedStringValueOf() 47 { 48 71 } 72 } 73 | Popular Tags |