01: package test.exceptionininitializer;
02:
03: public class ExceptionInInitializerTargetTest {
04: private static final String s_exceptionTriggerField = InnerClass
05: .generateException();
06:
07: /**
08: * @testng.test
09: */
10: public void fakeTestMethod() {
11: }
12:
13: private static class InnerClass {
14:
15: public static String generateException() {
16: if (true) {
17: throw new RuntimeException(
18: "exception in static field initializer");
19:
20: }
21: return null;
22: }
23: }
24: }
|