Throw exceptions in junit setup() methods?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kai_Middleton
Posted On:   Tuesday, December 30, 2008 07:30 PM

I have a setup method like this:



			
@BeforeClass
public static void setUpBeforeClass() throws Exception {
URL url = ClassLoader.getSystemResource(xmlFileName);
if (url == null)
throw new Exception("Could not load XML");
myXmlFile = new File(url.getFile());
}


If url is null, is it better to throw an exception like I do, or should I do something like this:



			
assertNotNull("couldn't load XML", url);
About | Sitemap | Contact