1 9 package org.jboss.portal.test; 10 11 import java.io.File ; 12 13 import javax.xml.parsers.DocumentBuilder ; 14 import javax.xml.parsers.DocumentBuilderFactory ; 15 16 import junit.framework.TestCase; 17 18 import org.apache.log4j.Logger; 19 import org.w3c.dom.Document ; 20 21 25 public abstract class AbstractTestCase extends TestCase 26 { 27 28 protected final Logger log = Logger.getLogger(getClass()); 29 protected final File resources; 30 31 protected AbstractTestCase(String name) 32 { 33 super(name); 34 resources = new File (System.getProperty("build.resources")); 35 } 36 37 public Document parseXML(File file) 38 { 39 try 40 { 41 DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); 42 return builder.parse(file); 43 } 44 catch (Exception e) 45 { 46 log.error("Cannot parse XML file", e); 47 fail("Cannot parse XML file"); 48 return null; 49 } 50 } 51 52 } 53 | Popular Tags |