aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java
blob: a3a76f2178836f0644c819a2c88fdfdb2c054298 (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
/*******************************************************************************
 * Copyright (c) 2004 IBM 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 *
 * Contributors:
 *    Andy Clement - initial API and implementation
 *******************************************************************************/
package org.aspectj.systemtest.ajc150;

import java.io.File;

import junit.framework.Test;

import org.aspectj.testing.XMLBasedAjcTestCase;


/**
 * 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 File getSpecFile() {
	    return new File("../tests/src/org/aspectj/systemtest/ajc150/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");
  }

}