protected void failNow(String failMsg) {
fail("Expected failure (" + failMsg + ")");
}
protected void failViaUncaughtException(final String failMsg) {
ButtonElement btn = Document.get().createPushButtonElement();
Document.get().getBody().appendChild(btn);
Event.sinkEvents(btn, Event.ONCLICK);
EventListener listener = new EventListener() {
@Override
public void onBrowserEvent(Event event) {
failNow(failMsg);
}
};
DOM.setEventListener(btn, listener);
btn.click();
}