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.

CheckerTestCase.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  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://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver.bcel;
  13. import java.io.IOException;
  14. import org.aspectj.bridge.IMessage;
  15. import org.aspectj.bridge.MessageHandler;
  16. import org.aspectj.weaver.Checker;
  17. import org.aspectj.weaver.patterns.DeclareErrorOrWarning;
  18. public class CheckerTestCase extends WeaveTestCase {
  19. {
  20. regenerate = false;
  21. }
  22. public CheckerTestCase(String name) {
  23. super(name);
  24. }
  25. public void testStaticTjp() throws IOException {
  26. Checker checker = new Checker(
  27. new DeclareErrorOrWarning(true, makePointcutPrintln(), "hey, we found a println"));
  28. MessageHandler handler = new MessageHandler();
  29. world.setMessageHandler(handler);
  30. weaveTest("HelloWorld", "IdHelloWorld", checker);
  31. assertEquals(1, handler.numMessages(IMessage.ERROR, false));
  32. handler = new MessageHandler();
  33. world.setMessageHandler(handler);
  34. weaveTest("FancyHelloWorld", "IdFancyHelloWorld", checker);
  35. assertEquals(3, handler.numMessages(IMessage.ERROR, false));
  36. }
  37. }