--- /dev/null 2012-10-26 10:38:27.041990198 +0200 +++ new/test/sun/misc/ThrowableTrace/ThrowableTraceTest.java 2012-11-15 11:40:42.000000000 +0100 @@ -0,0 +1,44 @@ +/* + * @bug 8003471 + * @test TestExceptionEvents + * @build ThrowableTracer + * @run main/othervm ThrowableTraceTest + */ +public class ThrowableTraceTest { + + public ThrowableTraceTest() throws Exception { + ThrowableTracer t = new ThrowableTracer(); + ThrowableTracer.enable(t); + + int exceptionsToThrow = 5; + int errorsToThrow = 5; + + for (int i = 0; i < exceptionsToThrow; i++) { + try { + throw new Exception(); + } catch (Exception e) { + + } + } + + for (int i = 0; i < errorsToThrow; i++) { + try { + throw new Error(); + } catch (Error e) { + + } + } + + if (t.getExceptions() < exceptionsToThrow) { + throw new Exception ("Not enough errors events generated!"); + } + + if (t.getErrors() < errorsToThrow) { + throw new Exception ("Not enough errors events generated!"); + } + } + + public static void main(String[] args) throws Exception { + new ThrowableTraceTest(); + } +}