diff options
author | aclement <aclement> | 2008-10-14 22:54:39 +0000 |
---|---|---|
committer | aclement <aclement> | 2008-10-14 22:54:39 +0000 |
commit | fa62ef97cd21cb7f7904735d4c877d2bf3555a60 (patch) | |
tree | 7581e54ac7535c9f15ea3ee04b6e704fb145443f /weaver5/java5-testsrc | |
parent | a0cb79d556316e0b25c57916582ac6fa64ddadf9 (diff) | |
download | aspectj-fa62ef97cd21cb7f7904735d4c877d2bf3555a60.tar.gz aspectj-fa62ef97cd21cb7f7904735d4c877d2bf3555a60.zip |
change due to 250632 change
Diffstat (limited to 'weaver5/java5-testsrc')
-rw-r--r-- | weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java index 5861c0220..a1ef7cd75 100644 --- a/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java +++ b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java @@ -12,22 +12,19 @@ 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. */ @@ -36,9 +33,11 @@ public class TestJava5ReflectionBasedReferenceTypeDelegate extends ReflectionBas world.resolve(collectionType).getRawType().resolve(world); ResolvedMember[] methods = world.resolve(collectionType).getDeclaredMethods(); int i = findMethod("toArray", 1, methods); - assertTrue("Couldn't find 'toArray' in the set of methods? ",i != -1); - String expectedSignature = "java.lang.Object[] java.util.Collection.toArray(java.lang.Object[])"; - assertTrue("Expected signature of '"+expectedSignature+"' but it was '"+methods[i],methods[i].toString().equals(expectedSignature)); + assertTrue("Couldn't find 'toArray' in the set of methods? ", i != -1); + // String expectedSignature = "java.lang.Object[] java.util.Collection.toArray(java.lang.Object[])"; + String expectedSignature = "([Ljava/lang/Object;)Ljava/lang/Object;"; + assertTrue("Expected signature of '" + expectedSignature + "' but it was '" + methods[i].getSignatureErased(), methods[i] + .getSignatureErased().equals(expectedSignature)); } /** @@ -46,33 +45,33 @@ public class TestJava5ReflectionBasedReferenceTypeDelegate extends ReflectionBas */ public void testResolveEnum() { ResolvedType enumType = world.resolve("java.lang.Enum"); - assertTrue("Should be the raw type but is "+enumType.typeKind,enumType.isRawType()); + assertTrue("Should be the raw type but is " + enumType.typeKind, enumType.isRawType()); ResolvedType theGenericEnumType = enumType.getGenericType(); - assertTrue("Should have a type variable ",theGenericEnumType.getTypeVariables().length>0); + assertTrue("Should have a type variable ", theGenericEnumType.getTypeVariables().length > 0); TypeVariable tv = theGenericEnumType.getTypeVariables()[0]; String expected = "TypeVar E extends java.lang.Enum<E>"; - assertTrue("Type variable should be '"+expected+"' but is '"+tv+"'",tv.toString().equals(expected)); + assertTrue("Type variable should be '" + expected + "' but is '" + tv + "'", tv.toString().equals(expected)); } - + public void testResolveClass() { - world.resolve("java.lang.Class").getGenericType(); + world.resolve("java.lang.Class").getGenericType(); } - - public void testGenericInterfaceSuperclass_ReflectionWorldResolution() { - - UnresolvedType javaUtilMap = UnresolvedType.forName("java.util.Map"); - - ReferenceType rawType = (ReferenceType) world.resolve(javaUtilMap); - assertTrue("Should be the raw type ?!? "+rawType.getTypekind(),rawType.isRawType()); - - ReferenceType genericType = (ReferenceType)rawType.getGenericType(); - assertTrue("Should be the generic type ?!? "+genericType.getTypekind(),genericType.isGenericType()); - - ResolvedType rt = rawType.getSuperclass(); - assertTrue("Superclass for Map raw type should be Object but was "+rt,rt.equals(UnresolvedType.OBJECT)); - - ResolvedType rt2 = genericType.getSuperclass(); - assertTrue("Superclass for Map generic type should be Object but was "+rt2,rt2.equals(UnresolvedType.OBJECT)); - } - + + public void testGenericInterfaceSuperclass_ReflectionWorldResolution() { + + UnresolvedType javaUtilMap = UnresolvedType.forName("java.util.Map"); + + ReferenceType rawType = (ReferenceType) world.resolve(javaUtilMap); + assertTrue("Should be the raw type ?!? " + rawType.getTypekind(), rawType.isRawType()); + + ReferenceType genericType = (ReferenceType) rawType.getGenericType(); + assertTrue("Should be the generic type ?!? " + genericType.getTypekind(), genericType.isGenericType()); + + ResolvedType rt = rawType.getSuperclass(); + assertTrue("Superclass for Map raw type should be Object but was " + rt, rt.equals(UnresolvedType.OBJECT)); + + ResolvedType rt2 = genericType.getSuperclass(); + assertTrue("Superclass for Map generic type should be Object but was " + rt2, rt2.equals(UnresolvedType.OBJECT)); + } + }
\ No newline at end of file |