use of com.google.gwt.core.client.Callback in project kie-wb-common by kiegroup.
the class NewResourcesMenuTest method testOnWorkspaceProjectContextChangedEnabled.
@Test
@SuppressWarnings("unchecked")
public void testOnWorkspaceProjectContextChangedEnabled() {
doAnswer(new Answer() {
@Override
public Object answer(final InvocationOnMock invocation) {
final Object[] args = invocation.getArguments();
final Callback callback = (Callback) args[0];
callback.onSuccess(true);
return null;
}
}).when(handler).acceptContext(any(Callback.class));
// Arguments aren't actually used
menu.onChange(null, null);
verify(handler, times(1)).acceptContext(any(Callback.class));
final List<MenuItem> menus = menu.getMenuItems();
verify(handler, times(2)).acceptContext(any(Callback.class));
final MenuItem mi = menus.get(0);
assertTrue(mi.isEnabled());
}
Aggregations