source: boa/src/test/java/geniusweb/boa/CrashingClassTest.java@ 52

Last change on this file since 52 was 52, checked in by ruud, 14 months ago

Fixed small issues in domaineditor.

File size: 850 bytes
Line 
1package geniusweb.boa;
2
3import static org.junit.Assert.assertTrue;
4
5import org.junit.Test;
6
7public class CrashingClassTest {
8 private static final String CRASHINGCLASSPATH = "geniusweb.boa.CrashingClass";
9
10 @Test(expected = ExceptionInInitializerError.class)
11 public void testForNameCrashes() throws ClassNotFoundException {
12 // forName DOES run the static code.
13 Class<?> clazz = Class.forName(CRASHINGCLASSPATH);
14 }
15
16 @Test
17 public void testLoadCrashes() throws ClassNotFoundException {
18 // loadClass does NOT run the static code.
19 Class<?> clazz = this.getClass().getClassLoader()
20 .loadClass(CRASHINGCLASSPATH);
21 assertTrue(clazz.isAssignableFrom(CrashingClass.class));
22 }
23
24 @Test
25 public void testImportCrashes() {
26 // refering to crashing class does NOT trigger the static code
27 Class<CrashingClass> clazz = CrashingClass.class;
28 }
29}
Note: See TracBrowser for help on using the repository browser.