detecting a problem in a test explicitly.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11967 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke 2008-09-02 21:58:24 +00:00
parent f0a7f18f8e
commit a82273ad38
1 changed files with 11 additions and 2 deletions

View File

@ -13,10 +13,13 @@ import hudson.model.FreeStyleProject;
import hudson.model.Hudson;
import hudson.model.Item;
import hudson.model.UpdateCenter;
import hudson.model.Saveable;
import hudson.tasks.Mailer;
import hudson.Launcher.LocalLauncher;
import hudson.util.StreamTaskListener;
import hudson.util.ProcessTreeKiller;
import hudson.remoting.Channel;
import hudson.maven.MavenBuildProxy;
import junit.framework.TestCase;
import org.jvnet.hudson.test.HudsonHomeLoader.CopyExisting;
import org.jvnet.hudson.test.recipes.Recipe;
@ -269,6 +272,14 @@ public abstract class HudsonTestCase extends TestCase {
return this;
}
/**
* Sometimes a part of a test case may ends up creeping into the serialization tree of {@link Saveable#save()},
* so detect that and flag that as an error.
*/
private Object writeReplace() {
throw new AssertionError("HudsonTestCase "+getName()+" is not supposed to be serialized");
}
/**
* Extends {@link com.gargoylesoftware.htmlunit.WebClient} and provide convenience methods
* for accessing Hudson.
@ -386,7 +397,5 @@ public abstract class HudsonTestCase extends TestCase {
System.setProperty("hudson.unitTest","true");
}
private static final Logger LOGGER = Logger.getLogger(HudsonTestCase.class.getName());
}