1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.validator;
18
19 import java.io.IOException;
20 import java.io.InputStream;
21
22 import junit.framework.TestCase;
23
24 import org.xml.sax.SAXException;
25
26 /***
27 * Consolidates reading in XML config file into parent class.
28 *
29 * @version $Revision: 478334 $ $Date: 2006-11-22 21:31:54 +0000 (Wed, 22 Nov 2006) $
30 */
31 abstract public class TestCommon extends TestCase {
32
33 /***
34 * Resources used for validation tests.
35 */
36 protected ValidatorResources resources = null;
37
38 public TestCommon(String string) {
39 super(string);
40 }
41
42 /***
43 * Load <code>ValidatorResources</code> from
44 * validator-numeric.xml.
45 */
46 protected void loadResources(String file) throws IOException, SAXException {
47
48 InputStream in = null;
49
50 try {
51 in = this.getClass().getResourceAsStream(file);
52 resources = new ValidatorResources(in);
53 } finally {
54 if (in != null) {
55 in.close();
56 }
57 }
58 }
59 }