1 /*
2 * Created on Sep 1, 2003
3 *
4 * Copyright (C) 2003 CodeStreet. All Rights Reserved.
5 */
6 package attrib4j.tests;
7
8 import attrib4j.Attribute;
9 import attrib4j.Attributes;
10 import attrib4j.examples.attributes.PointCutAttribute;
11 import junit.framework.TestCase;
12
13 /***
14 * Test case to parse some more complex method aguments. Really
15 * need to change to a proper grammer based parse....
16 * @author <a href="mailto:mark.pollack@codestreet.com">Mark Pollack</a>
17 *
18 */
19 public class ParamParseTest extends TestCase {
20
21 /***
22 * Constructor for ParamParseTest.
23 * @param name Name of the test for JUnit
24 */
25 public ParamParseTest(String name) {
26 super(name);
27 }
28
29 /***
30 * Test case for parsing of some more 'complex' parameters.
31 * @throws Exception JUnit will catch it.
32 */
33 public void testParamParse() throws Exception {
34 Class cls = attrib4j.examples.ParamParseExample.class;
35
36 //Check to see if we have the right number of attributes.
37 Attribute[] custAttrs = Attributes.getAttributes(cls);
38 assertEquals(
39 "not right number of class attributes",
40 1,
41 custAttrs.length);
42
43 //Get a ref to the java.lang.Class for this attribute.
44 Class attributeFilter =
45 Class.forName("attrib4j.examples.attributes.PointCutAttribute");
46
47 //Get the attributes of this type.
48 Attribute[] pointcutAttribs =
49 Attributes.getAttributes(cls, attributeFilter);
50
51
52 assertEquals(
53 "not correct number of DebugAttributes",
54 1,
55 pointcutAttribs.length);
56
57 PointCutAttribute pointcutAttribute = (PointCutAttribute) pointcutAttribs[0];
58 System.out.println("****** PointCutAttribute.toString() = " + pointcutAttribute);
59 assertEquals(
60 "Debugging attribute has wrong value",
61 "* *.set*(..)",
62 //"foo",
63 pointcutAttribute.getMethodPattern());
64
65 }
66
67 }
This page was automatically generated by Maven