Skip to content

Instantly share code, notes, and snippets.

@nbuesing
Last active December 26, 2015 04:08
Show Gist options
  • Save nbuesing/7090504 to your computer and use it in GitHub Desktop.
Save nbuesing/7090504 to your computer and use it in GitHub Desktop.
private SampleWidget sampleWidget;
private ClickHandler clickHandler;
@Before
public void setUp() {
Mockito.when(button.addClickHandler(Mockito.any(ClickHandler.class))).thenAnswer(new Answer() {
public Object answer(InvocationOnMock aInvocation) throws Throwable {
clickHandler = (ClickHandler) aInvocation.getArguments()[0];
return null;
}
});
sampleWidget = new SampleWidget();
}
@Test
public void clickOnButton() {
clickHandler.onClick(new ClickEvent(){});
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment