diff options
author | acolyer <acolyer> | 2005-11-25 17:32:31 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-11-25 17:32:31 +0000 |
commit | dd1c1b6b4a127a9bdc51f958ca05c3260fa5c64c (patch) | |
tree | 3b5cec811d8da14ce66579bdc755a57808810871 | |
parent | 361757b0fcfc845efaa75ed062e9a6178d050764 (diff) | |
download | aspectj-dd1c1b6b4a127a9bdc51f958ca05c3260fa5c64c.tar.gz aspectj-dd1c1b6b4a127a9bdc51f958ca05c3260fa5c64c.zip |
ensure this test works on non-windows machines too!
2 files changed, 21 insertions, 2 deletions
diff --git a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java index 03ed66dd9..26c34db9e 100644 --- a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java +++ b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java @@ -105,6 +105,15 @@ public class ReflectionBasedReferenceTypeDelegateTest extends TestCase { return -1; } + protected int findMethod(String name, int numArgs, ResolvedMember[] methods) { + for (int i=0; i<methods.length; i++) { + if (name.equals(methods[i].getName()) && (methods[i].getParameterTypes().length == numArgs)) { + return i; + } + } + return -1; + } + public void testGetDeclaredMethods() { ResolvedMember[] methods = objectType.getDeclaredMethods(); assertEquals(Object.class.getDeclaredMethods().length + Object.class.getDeclaredConstructors().length, methods.length); diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java index aadfd525b..a91e674bc 100644 --- a/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java +++ b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java @@ -1,17 +1,27 @@ package org.aspectj.weaver; +import junit.framework.Test; +import junit.framework.TestSuite; + import org.aspectj.weaver.reflect.ReflectionBasedReferenceTypeDelegateTest; public class TestJava5ReflectionBasedReferenceTypeDelegate extends ReflectionBasedReferenceTypeDelegateTest { + public static Test suite() { + TestSuite suite = new TestSuite("TestJava5ReflectionBasedReferenceTypeDelegate"); + suite.addTestSuite(TestJava5ReflectionBasedReferenceTypeDelegate.class); + return suite; + } + + /** * Let's play about with a generic type and ensure we can work with it in a reflective world. */ public void testResolveGeneric() { UnresolvedType collectionType = UnresolvedType.forName("java.util.Collection"); - ResolvedType rt= world.resolve(collectionType).getRawType().resolve(world); + world.resolve(collectionType).getRawType().resolve(world); ResolvedMember[] methods = world.resolve(collectionType).getDeclaredMethods(); - int i = findMethod("toArray", methods); + int i = findMethod("toArray", 1, methods); assertTrue("Couldn't find 'toArray' in the set of methods? "+methods,i != -1); String expectedSignature = "T[] java.util.Collection.toArray(T[])"; assertTrue("Expected signature of '"+expectedSignature+"' but it was '"+methods[i],methods[i].toString().equals(expectedSignature)); |