Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*******************************************************************************
  2. * Copyright (c) 2004 IBM
  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. * Andy Clement - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.systemtest.ajc150;
  12. import java.io.File;
  13. import junit.framework.Test;
  14. import org.aspectj.testing.XMLBasedAjcTestCase;
  15. /**
  16. * Varargs, the rules/tests:
  17. *
  18. * 1. cannot match on a varargs method by using 'Object[]' in your signature,
  19. * this affects call/execution/initialization/withincode
  20. */
  21. public class VarargsTests extends XMLBasedAjcTestCase {
  22. public static Test suite() {
  23. return XMLBasedAjcTestCase.loadSuite(VarargsTests.class);
  24. }
  25. protected File getSpecFile() {
  26. return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
  27. }
  28. // check when signature is from a call PCD
  29. // should get message:
  30. // "an array type as the last parameter in a signature does not match on the varargs declared method: <blah>"
  31. public void test001_cantMatchVarargsWithObjectArray_callPCD() {
  32. runTest("varargs not matched by Object[] (call)");
  33. }
  34. // check when signature is from an execution PCD
  35. public void test002_cantMatchVarargsWithObjectArray_execPCD() {
  36. runTest("varargs not matched by Object[] (exe)");
  37. }
  38. // check when signature is from an initialization PCD
  39. public void test003_cantMatchVarargsWithObjectArray_initPCD() {
  40. runTest("varargs not matched by Object[] (init)");
  41. }
  42. // check when signature is from an withincode PCD
  43. public void test003_cantMatchVarargsWithObjectArray_withincodePCD() {
  44. runTest("varargs not matched by Object[] (withincode)");
  45. }
  46. // before(): call(* *(Integer...)) { }
  47. public void test_usingVarargsInPointcuts1() {
  48. runTest("call with varargs signature");
  49. }
  50. // before(): call(* *(int,Integer...)) { } - slightly more complex pcut
  51. public void test_usingVarargsInPointcuts2() {
  52. runTest("call with varargs multi-signature");
  53. }
  54. }