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