1   /*
2    * $Header: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ByteTest.java,v 1.14 2004/02/21 17:10:30 rleland Exp $
3    * $Revision: 1.14 $
4    * $Date: 2004/02/21 17:10:30 $
5    *
6    * ====================================================================
7    * Copyright 2001-2004 The Apache Software Foundation
8    *
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   *
13   *     http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   */
21  
22  
23  package org.apache.commons.validator;
24  
25  import junit.framework.Test;
26  import junit.framework.TestSuite;
27  import java.io.IOException;
28  import org.xml.sax.SAXException;
29  import java.util.Locale;
30  import java.net.URL;
31  
32  
33  /***                                                       
34   * Tests entity imports.
35   */
36  public class EntityImportTest extends TestCommon {
37  
38      public EntityImportTest(String name) {
39          super(name);
40      }
41  
42      /***
43       * Start the tests.
44       *
45       * @param theArgs the arguments. Not used
46       */
47      public static void main(String[] theArgs) {
48          junit.awtui.TestRunner.main(new String[]{EntityImportTest.class.getName()});
49      }
50  
51      /***
52       * @return a test suite (<code>TestSuite</code>) that includes all methods
53       *         starting with "test"
54       */
55      public static Test suite() {
56          // All methods starting with "test" will be executed in the test suite.
57          return new TestSuite(EntityImportTest.class);
58      }
59  
60      /***
61       * Tests the entity import loading the <code>byteForm</code> form.
62       */
63      public void testEntityImport() throws Exception {
64          URL url = getClass().getResource("EntityImportTest-config.xml");
65          ValidatorResources resources = new ValidatorResources(url.toExternalForm());
66          assertNotNull("Form should be found", resources.getForm(Locale.getDefault(), "byteForm"));
67      }  
68  }