1   package org.codehaus.dataforge.engine.configuration;
2   
3   /*
4    * Copyright 2001-2004 Ben Walding
5    * 
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * 
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import junit.framework.TestCase;
20  
21  import org.codehaus.dataforge.engine.DataForge;
22  
23  /***
24   * @author <a href="mailto:ben@walding.com">Ben Walding</a>
25   * @version $Id: ValidationTest.java,v 1.4 2004/02/22 01:10:52 bwalding Exp $
26   */
27  public class ValidationTest extends TestCase {
28      /*** log4j logger */
29      private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(ValidationTest.class);
30  
31  
32      public void testSimple() {
33          try {
34              LOGGER.info("It is expected that digester will display a single parse exception.  We are testing to make sure the exception is thrown by the error handler.");
35              DataForge df = XMLConfiguration.quickConfig(getClass(), "ValidationTest1.df.invalid");
36              fail("The configuration file does not follow the DTD.  Loading it should have thrown an Exception");
37              df.getClass(); //Stop code warnings
38          } catch (Exception ex) {
39              //Success
40          }
41      }
42  }