KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > cglib > transform > impl > TestProvideFields


1 /*
2  * Copyright 2003 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package net.sf.cglib.transform.impl;
18
19 import net.sf.cglib.transform.*;
20 import junit.framework.*;
21
22 /**
23  *
24  * @author baliuka
25  */

26 public class TestProvideFields extends AbstractTransformTest{
27     
28     String JavaDoc field = "test";
29     
30     /** Creates a new instance of TestProvideFields */
31     public TestProvideFields() {
32     }
33     
34     /** Creates a new instance of TestProvideFields */
35     public TestProvideFields(String JavaDoc name) {
36         super(name);
37     }
38     
39     
40     public void test(){
41     
42        FieldProvider provider = (FieldProvider)this;
43        assertEquals(field,provider.getField("field"));
44        String JavaDoc value = "tst2";
45        provider.setField("field", value );
46        assertEquals(field,value);
47        
48        
49         
50     }
51     
52     protected ClassTransformerFactory getTransformer() throws Exception JavaDoc {
53        
54         return new ClassTransformerFactory (){
55         
56            public ClassTransformer newInstance(){
57        
58                 return new FieldProviderTransformer();
59            }
60         };
61     }
62     
63     
64     public static void main(String JavaDoc[] args) throws Exception JavaDoc{
65         junit.textui.TestRunner.run(suite());
66     }
67     
68     public static Test suite() throws Exception JavaDoc{
69         return new TestSuite( new TestProvideFields( ).transform() );
70     }
71     
72
73     
74     
75 }
76
Popular Tags