equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
153 else fail(x + " not equal to " + y);} |
153 else fail(x + " not equal to " + y);} |
154 public static void main(String[] args) throws Throwable { |
154 public static void main(String[] args) throws Throwable { |
155 try {realMain(args);} catch (Throwable t) {unexpected(t);} |
155 try {realMain(args);} catch (Throwable t) {unexpected(t);} |
156 System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); |
156 System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); |
157 if (failed > 0) throw new AssertionError("Some tests failed");} |
157 if (failed > 0) throw new AssertionError("Some tests failed");} |
158 private static abstract class Fun {abstract void f() throws Throwable;} |
|
159 static void THROWS(Class<? extends Throwable> k, Fun... fs) { |
|
160 for (Fun f : fs) |
|
161 try { f.f(); fail("Expected " + k.getName() + " not thrown"); } |
|
162 catch (Throwable t) { |
|
163 if (k.isAssignableFrom(t.getClass())) pass(); |
|
164 else unexpected(t);}} |
|
165 private static abstract class CheckedThread extends Thread { |
158 private static abstract class CheckedThread extends Thread { |
166 abstract void realRun() throws Throwable; |
159 abstract void realRun() throws Throwable; |
167 public void run() { |
160 public void run() { |
168 try {realRun();} catch (Throwable t) {unexpected(t);}}} |
161 try {realRun();} catch (Throwable t) {unexpected(t);}}} |
169 } |
162 } |