KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > digester > plugins > TestDelegate


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

17
18
19 package org.apache.commons.digester.plugins;
20
21 import junit.framework.Test;
22 import junit.framework.TestCase;
23 import junit.framework.TestSuite;
24
25 import org.apache.commons.digester.Digester;
26
27 /**
28  * Test cases for Delegate behaviour.
29  */

30
31 public class TestDelegate extends TestCase {
32     /** Standard constructor */
33     public TestDelegate(String JavaDoc name) {
34         super(name);
35     }
36
37     /** Set up instance variables required by this test case. */
38     public void setUp() {}
39
40     /** Return the tests included in this test suite. */
41     public static Test suite() {
42         return (new TestSuite(TestDelegate.class));
43     }
44
45     /** Tear down instance variables required by this test case.*/
46     public void tearDown() {}
47         
48     // --------------------------------------------------------------- Test cases
49

50     public void testDummy() {
51         // it is an error if a TestSuite doesn't have at least one test,
52
// so here is one...
53
}
54     
55     public void ignoretestDelegate() throws Exception JavaDoc {
56         // this method tests the Delegate functionality by capturing all
57
// data below the specified pattern, and printing it to stdout.
58
// I can't for the moment think how to turn this into a unit test,
59
// so this test is disabled.
60
Digester digester = new Digester();
61         PluginRules rc = new PluginRules();
62         digester.setRules(rc);
63         
64         DumperRule dr = new DumperRule();
65         digester.addRule("root", dr);
66         
67         try {
68             digester.parse(
69                 TestAll.getInputStream(this, "test1.xml"));
70         }
71         catch(Exception JavaDoc e) {
72             throw e;
73         }
74     }
75 }
76
Popular Tags