You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TypeVariableReferenceTypeTestCase.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* *******************************************************************
  2. * Copyright (c) 2005 Contributors.
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Adrian Colyer Initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver;
  13. import junit.framework.TestCase;
  14. import org.aspectj.weaver.bcel.BcelWorld;
  15. /**
  16. * @author colyer
  17. *
  18. */
  19. public class TypeVariableReferenceTypeTestCase extends TestCase {
  20. ReferenceType javaLangClass;
  21. ReferenceType javaLangObject;
  22. BoundedReferenceType extendsClass;
  23. BoundedReferenceType superClass;
  24. BoundedReferenceType extendsWithExtras;
  25. BcelWorld world;
  26. public void testConstructionByNameAndVariable() {
  27. TypeVariable tv = new TypeVariable("T", javaLangClass);
  28. TypeVariableReferenceType tvrt = new TypeVariableReferenceType(tv, world);
  29. assertEquals("T", tvrt.getTypeVariable().getName());
  30. assertEquals(javaLangClass, tvrt.getTypeVariable().getUpperBound());
  31. }
  32. @Override
  33. protected void setUp() throws Exception {
  34. super.setUp();
  35. world = new BcelWorld();
  36. javaLangClass = (ReferenceType) world.resolve(UnresolvedType.forName("java/lang/Class"));
  37. javaLangObject = (ReferenceType) world.resolve(UnresolvedType.OBJECT);
  38. extendsClass = new BoundedReferenceType(javaLangClass, true, world);
  39. superClass = new BoundedReferenceType(javaLangClass, false, world);
  40. extendsWithExtras = new BoundedReferenceType(javaLangClass, true, world, new ReferenceType[] { (ReferenceType) world
  41. .resolve(UnresolvedType.forName("java/util/List")) });
  42. }
  43. }