convenience method to use the preset dataset.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11505 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-08-15 21:22:19 +00:00
1 parent 3ab6198337
commit 42d3dc135b
1 file changed
+15
@@ -16,6 +16,7 @@ import org.xml.sax.SAXException;
import javax.servlet.ServletContext;
import java.io.File;
import java.io.IOException;
import java.net.URL;
/**
* Base class for all Hudson test cases.
@@ -114,6 +115,20 @@ public abstract class HudsonTestCase extends TestCase {
return this;
}
/**
* Declares that this test case expects to start with one of the preset data sets.
* See https://svn.dev.java.net/svn/hudson/trunk/hudson/main/test/src/main/preset-data/
* for available datasets and what they mean.
*/
protected HudsonTestCase withPresetData(String name) {
name = "/" + name + ".zip";
URL res = getClass().getResource(name);
if(res==null) throw new IllegalArgumentException("No such data set found: "+name);
homeLoader = new CopyExisting(res);
return this;
}
/**
* Extends {@link com.gargoylesoftware.htmlunit.WebClient} and provide convenience methods
* for accessing Hudson.