use of org.uberfire.ext.widgets.common.client.menu.MenuItemHeaderView in project drools-wb by kiegroup.
the class ViewMenuBuilderTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
menuItemFactory = new MenuItemFactory(menuItemViewProducer);
menuItemFactoryViewMocks.clear();
when(dtPresenter.getAccess()).thenReturn(access);
when(ts.getTranslation(any(String.class))).thenReturn("i18n");
when(menuItemViewProducer.select(any(Annotation.class))).thenAnswer((o) -> {
final Annotation a = (Annotation) o.getArguments()[0];
if (a.annotationType().equals(MenuItemHeader.class)) {
return menuItemViewHeaderProducer;
} else if (a.annotationType().equals(MenuItemWithIcon.class)) {
return menuItemViewWithIconProducer;
} else if (a.annotationType().equals(MenuItemDivider.class)) {
return menuItemViewDividerProducer;
}
throw new IllegalArgumentException("Unexpected MenuItemView");
});
when(menuItemViewHeaderProducer.get()).then(invocation -> {
final MenuItemHeaderView v = mock(MenuItemHeaderView.class);
menuItemFactoryViewMocks.add(v);
return v;
});
when(menuItemViewWithIconProducer.get()).then(invocation -> {
final MenuItemWithIconView v = mock(MenuItemWithIconView.class);
menuItemFactoryViewMocks.add(v);
return v;
});
when(menuItemViewDividerProducer.get()).then(invocation -> {
final MenuItemDividerView v = mock(MenuItemDividerView.class);
menuItemFactoryViewMocks.add(v);
return v;
});
builder = spy(new ViewMenuBuilder(ts, menuItemFactory));
builder.setup();
builder.setModeller(modeller);
}
Aggregations