1
2
3
4
5
6
7
8 package org.codehaus.metaclass.tools.qdox;
9
10 import junit.framework.TestCase;
11 import org.codehaus.metaclass.model.Attribute;
12
13 /***
14 * @author Peter Donald
15 * @version $Revision: 1.3 $ $Date: 2003/11/28 11:14:55 $
16 */
17 public class NonNamespaceAttributeRemovingInterceptorTestCase
18 extends TestCase
19 {
20 public void testProcessAttributeWithNamespacedAttribute()
21 throws Exception
22 {
23 final NonNamespaceAttributeRemovingInterceptor interceptor =
24 new NonNamespaceAttributeRemovingInterceptor();
25 final Attribute attribute = new Attribute( "foo.baz" );
26 final Attribute result = interceptor.processAttribute( attribute );
27 assertEquals( "attribute", attribute, result );
28 }
29
30 public void testProcessAttributeWithNonNamespacedAttribute()
31 throws Exception
32 {
33 final NonNamespaceAttributeRemovingInterceptor interceptor =
34 new NonNamespaceAttributeRemovingInterceptor();
35 final Attribute attribute = new Attribute( "baz" );
36 final Attribute result = interceptor.processAttribute( attribute );
37 assertEquals( "attribute", null, result );
38 }
39
40 public void testProcessAttributeWithNamespaceSeparatorAtStart()
41 throws Exception
42 {
43 final NonNamespaceAttributeRemovingInterceptor interceptor =
44 new NonNamespaceAttributeRemovingInterceptor();
45 final Attribute attribute = new Attribute( ".baz" );
46 final Attribute result = interceptor.processAttribute( attribute );
47 assertEquals( "attribute", null, result );
48 }
49
50 public void testProcessAttributeWithNamespaceSeparatorAtEnd()
51 throws Exception
52 {
53 final NonNamespaceAttributeRemovingInterceptor interceptor =
54 new NonNamespaceAttributeRemovingInterceptor();
55 final Attribute attribute = new Attribute( "baz." );
56 final Attribute result = interceptor.processAttribute( attribute );
57 assertEquals( "attribute", null, result );
58 }
59
60 public void testProcessClassAttribute()
61 throws Exception
62 {
63 final NonNamespaceAttributeRemovingInterceptor interceptor =
64 new NonNamespaceAttributeRemovingInterceptor();
65 final Attribute attribute = new Attribute( "foo.baz" );
66 final Attribute result = interceptor.processClassAttribute( null,
67 attribute );
68 assertEquals( "attribute", attribute, result );
69 }
70
71 public void testProcessMethodAttribute()
72 throws Exception
73 {
74 final NonNamespaceAttributeRemovingInterceptor interceptor =
75 new NonNamespaceAttributeRemovingInterceptor();
76 final Attribute attribute = new Attribute( "foo.baz" );
77 final Attribute result = interceptor.processMethodAttribute( null,
78 attribute );
79 assertEquals( "attribute", attribute, result );
80 }
81
82 public void testProcessFieldAttribute()
83 throws Exception
84 {
85 final NonNamespaceAttributeRemovingInterceptor interceptor =
86 new NonNamespaceAttributeRemovingInterceptor();
87 final Attribute attribute = new Attribute( "foo.baz" );
88 final Attribute result = interceptor.processFieldAttribute( null,
89 attribute );
90 assertEquals( "attribute", attribute, result );
91 }
92 }