Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

PointcutTestCase.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*******************************************************************************
  2. * Copyright (c) 2004 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Common Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/cpl-v10.html
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.weaver.patterns;
  12. import java.io.DataOutputStream;
  13. import java.io.IOException;
  14. import java.util.Set;
  15. import org.aspectj.lang.JoinPoint;
  16. import org.aspectj.lang.Signature;
  17. import org.aspectj.runtime.reflect.Factory;
  18. import org.aspectj.util.FuzzyBoolean;
  19. import org.aspectj.weaver.IntMap;
  20. import org.aspectj.weaver.ResolvedTypeX;
  21. import org.aspectj.weaver.Shadow;
  22. import org.aspectj.weaver.ast.Test;
  23. import junit.framework.TestCase;
  24. public class PointcutTestCase extends TestCase {
  25. public void testMatchJP() {
  26. Pointcut p = new Pointcut() {
  27. public Set couldMatchKinds() {
  28. return null;
  29. }
  30. public FuzzyBoolean fastMatch(FastMatchInfo info) {
  31. return null;
  32. }
  33. protected FuzzyBoolean matchInternal(Shadow shadow) {
  34. return null;
  35. }
  36. protected void resolveBindings(IScope scope, Bindings bindings) {
  37. }
  38. protected void resolveBindingsFromRTTI() {}
  39. protected Pointcut concretize1(ResolvedTypeX inAspect, IntMap bindings) {
  40. return null;
  41. }
  42. protected Test findResidueInternal(Shadow shadow, ExposedState state) {
  43. return null;
  44. }
  45. public void write(DataOutputStream s) throws IOException {
  46. }};
  47. Factory f = new Factory("PointcutTestCase.java",PointcutTestCase.class);
  48. Signature methodSig = f.makeMethodSig("void aMethod()");
  49. JoinPoint.StaticPart jpsp = f.makeSJP(JoinPoint.METHOD_EXECUTION,methodSig,1);
  50. JoinPoint jp = Factory.makeJP(jpsp,this,this);
  51. try {
  52. p.match(jp,null);
  53. fail("Expected UnsupportedOperationException to be thrown");
  54. } catch (UnsupportedOperationException unEx) {
  55. // ok
  56. }
  57. try {
  58. p.match(jpsp);
  59. fail("Expected UnsupportedOperationException to be thrown");
  60. } catch (UnsupportedOperationException unEx) {
  61. // ok
  62. }
  63. }
  64. }