aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org/aspectj/systemtest/ajc150/VarargsTests.java
blob: 63ea6d70a20add941cda92512a7e5a353d8b9266 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*******************************************************************************
 * Copyright (c) 2004 IBM
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
 *
 * Contributors:
 *    Andy Clement - initial API and implementation
 *******************************************************************************/
package org.aspectj.systemtest.ajc150;

import org.aspectj.testing.XMLBasedAjcTestCase;

import junit.framework.Test;


/**
 * Varargs, the rules/tests:
 *
 * 1. cannot match on a varargs method by using 'Object[]' in your signature,
 *    this affects call/execution/initialization/withincode
 */
public class VarargsTests extends XMLBasedAjcTestCase {

	  public static Test suite() {
	    return XMLBasedAjcTestCase.loadSuite(VarargsTests.class);
	  }

	  protected java.net.URL getSpecFile() {
	    return getClassResource("ajc150.xml");
	  }

  // check when signature is from a call PCD
  //   should get message:
  // "an array type as the last parameter in a signature does not match on the varargs declared method: <blah>"
  public void test001_cantMatchVarargsWithObjectArray_callPCD() {
  	runTest("varargs not matched by Object[] (call)");
  }

  // check when signature is from an execution PCD
  public void test002_cantMatchVarargsWithObjectArray_execPCD() {
  	runTest("varargs not matched by Object[] (exe)");
  }

  // check when signature is from an initialization PCD
  public void test003_cantMatchVarargsWithObjectArray_initPCD() {
  	runTest("varargs not matched by Object[] (init)");
  }

  // check when signature is from an withincode PCD
  public void test003_cantMatchVarargsWithObjectArray_withincodePCD() {
  	runTest("varargs not matched by Object[] (withincode)");
  }

  // before(): call(* *(Integer...)) { }
  public void test_usingVarargsInPointcuts1() {
  	runTest("call with varargs signature");
  }

  // before(): call(* *(int,Integer...)) { } - slightly more complex pcut
  public void test_usingVarargsInPointcuts2() {
  	runTest("call with varargs multi-signature");
  }

  public void testAJDKExamples() {
	  runTest("ajdk: varargs");
  }

  public void testStarVarargs() {
	  runTest("star varargs pattern");
  }

  public void testVarargsWithDotDotInPointcut() {
	  runTest("Varargs with .. in pointcut");
  }

}