75 lastThreadID.set(l.getThreadID());
76 }});
77 for (int i = 1; i < 4; i++) {
78 logger.warning(message); // Should invoke getHandlers()
79 equal(i, getHandlerCount.get());
80 }
81 }
82
83 //--------------------- Infrastructure ---------------------------
84 volatile int passed = 0, failed = 0;
85 void pass() {passed++;}
86 void fail() {failed++; Thread.dumpStack();}
87 void fail(String msg) {System.err.println(msg); fail();}
88 void unexpected(Throwable t) {failed++; t.printStackTrace();}
89 void check(boolean cond) {if (cond) pass(); else fail();}
90 void equal(Object x, Object y) {
91 if (x == null ? y == null : x.equals(y)) pass();
92 else fail(x + " not equal to " + y);}
93 public static void main(String[] args) throws Throwable {
94 try {new LoggerSubclass().instanceMain(args);}
95 catch (Throwable e) {throw e.getCause();}}
96 public void instanceMain(String[] args) throws Throwable {
97 try {test(args);} catch (Throwable t) {unexpected(t);}
98 System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
99 if (failed > 0) throw new AssertionError("Some tests failed");}
100 }
|
75 lastThreadID.set(l.getThreadID());
76 }});
77 for (int i = 1; i < 4; i++) {
78 logger.warning(message); // Should invoke getHandlers()
79 equal(i, getHandlerCount.get());
80 }
81 }
82
83 //--------------------- Infrastructure ---------------------------
84 volatile int passed = 0, failed = 0;
85 void pass() {passed++;}
86 void fail() {failed++; Thread.dumpStack();}
87 void fail(String msg) {System.err.println(msg); fail();}
88 void unexpected(Throwable t) {failed++; t.printStackTrace();}
89 void check(boolean cond) {if (cond) pass(); else fail();}
90 void equal(Object x, Object y) {
91 if (x == null ? y == null : x.equals(y)) pass();
92 else fail(x + " not equal to " + y);}
93 public static void main(String[] args) throws Throwable {
94 try {new LoggerSubclass().instanceMain(args);}
95 catch (Throwable e) {throw e.getCause() == null ? e : e.getCause();}}
96 public void instanceMain(String[] args) throws Throwable {
97 try {test(args);} catch (Throwable t) {unexpected(t);}
98 System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
99 if (failed > 0) throw new AssertionError("Some tests failed");}
100 }
|