Hello,

To improve the coverage of my automated tests, I'd like to test my own
GWT.UncaughtExceptionHandler within a GWTTestCase to see if it
functions correctly.

I can't do it for now: the JUnit test always fails.

Can you help me an let me know what's wrong in my code below ? (I
tried to use an asynchronous test to make sure that I am going through
the ExceptionHandler)

thanks
didier

public class TestExceptionHandler extends GWTTestCase {

        public void testWithHandler() {
                ExceptionHandler handler = new
ExceptionHandler(GWT.getUncaughtExceptionHandler());
                GWT.setUncaughtExceptionHandler(handler);
                this.delayTestFinish(1000);
                throw new ClientException("test");
        }

        private class ExceptionHandler implements
GWT.UncaughtExceptionHandler {

                private GWT.UncaughtExceptionHandler handler;

                public ExceptionHandler(GWT.UncaughtExceptionHandler h) {
                        this.handler = h;
                }

                @Override
                public void onUncaughtException(Throwable e) {
                        System.out.println("Exception handler called!");
                        TestExceptionHandler.this.finishTest();
                        this.handler.onUncaughtException(e);
                }
        }

       @Override
        public String getModuleName() {
                return "MyModule";
        }

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to