File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\test\src\test\java\hudson\ExceptionTest.java.html

1 package hudson;
2
3 import com.gargoylesoftware.htmlunit.ScriptException;
4 import org.jvnet.hudson.test.HudsonTestCase;
5
6 /**
7 * @author Kohsuke Kawaguchi
8 */
9 public class ExceptionTest extends HudsonTestCase {
10 /**
11 * Makes sure that an AJAX handler error results in a fatal problem in the unit test.
12 */
13 public void testAjaxError() throws Exception {
14 try {
15 createWebClient().goTo("/self/ajaxError");
16 fail("should have resulted in a ScriptException");
17 } catch (ScriptException e) {
18 if (e.getMessage().contains("simulated error"))
19 return; // as expected
20 throw e;
21
22 }
23 }
24 }
25