@Test public void checkFocusEvent() { tested = false; Button b = new Button(); b.addFocusHandler( new FocusHandler() { public void onFocus(FocusEvent event) { tested = !tested; } }); // simule the event focus(b); Assert.assertTrue("onFocus event was not triggered", tested); }