1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit;
16
17 import static org.junit.Assert.assertTrue;
18
19 import java.io.PrintWriter;
20 import java.io.StringWriter;
21 import java.io.Writer;
22
23 import org.junit.Test;
24
25
26
27
28
29
30 public class ObjectInstantiationExceptionTest {
31
32
33
34
35 @Test
36 public void test() throws Exception {
37 final Throwable originalExcpetion = new Exception("original exception");
38 final ObjectInstantiationException oie = new ObjectInstantiationException("OIE", originalExcpetion);
39 final RuntimeException runtimeException = new RuntimeException("runtime exception", oie);
40 final Writer writer = new StringWriter();
41 runtimeException.printStackTrace(new PrintWriter(writer));
42 assertTrue(writer.toString().contains("original exception"));
43 }
44 }