49 list.equals(Collections.EMPTY_LIST);
50 }
51 t.join();
52 check(list.size() == 0);
53 }
54
55 //--------------------- Infrastructure ---------------------------
56 static volatile int passed = 0, failed = 0;
57 static void pass() {passed++;}
58 static void fail() {failed++; Thread.dumpStack();}
59 static void fail(String msg) {System.out.println(msg); fail();}
60 static void unexpected(Throwable t) {failed++; t.printStackTrace();}
61 static void check(boolean cond) {if (cond) pass(); else fail();}
62 static void equal(Object x, Object y) {
63 if (x == null ? y == null : x.equals(y)) pass();
64 else fail(x + " not equal to " + y);}
65 public static void main(String[] args) throws Throwable {
66 try {realMain(args);} catch (Throwable t) {unexpected(t);}
67 System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
68 if (failed > 0) throw new AssertionError("Some tests failed");}
69 private static abstract class CheckedThread extends Thread {
70 public abstract void realRun() throws Throwable;
71 public void run() {
72 try { realRun(); } catch (Throwable t) { unexpected(t); }}}
73 }
|
49 list.equals(Collections.EMPTY_LIST);
50 }
51 t.join();
52 check(list.size() == 0);
53 }
54
55 //--------------------- Infrastructure ---------------------------
56 static volatile int passed = 0, failed = 0;
57 static void pass() {passed++;}
58 static void fail() {failed++; Thread.dumpStack();}
59 static void fail(String msg) {System.out.println(msg); fail();}
60 static void unexpected(Throwable t) {failed++; t.printStackTrace();}
61 static void check(boolean cond) {if (cond) pass(); else fail();}
62 static void equal(Object x, Object y) {
63 if (x == null ? y == null : x.equals(y)) pass();
64 else fail(x + " not equal to " + y);}
65 public static void main(String[] args) throws Throwable {
66 try {realMain(args);} catch (Throwable t) {unexpected(t);}
67 System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
68 if (failed > 0) throw new AssertionError("Some tests failed");}
69 private abstract static class CheckedThread extends Thread {
70 public abstract void realRun() throws Throwable;
71 public void run() {
72 try { realRun(); } catch (Throwable t) { unexpected(t); }}}
73 }
|