ViewMenuBuilder extends BaseMenu implements MenuFactory.CustomMenuBuilder { void onZoom(final int zoom) { modeller.setZoom(zoom); miZoom125pct.getMenuItemView().setIconType(null); miZoom100pct.getMenuItemView().setIconType(null); miZoom75pct.getMenuItemView().setIconType(null); miZoom50pct.getMenuItemView().setIconType(null); switch (zoom) { case 125: miZoom125pct.getMenuItemView().setIconType(IconType.CHECK); break; case 100: miZoom100pct.getMenuItemView().setIconType(IconType.CHECK); break; case 75: miZoom75pct.getMenuItemView().setIconType(IconType.CHECK); break; case 50: miZoom50pct.getMenuItemView().setIconType(IconType.CHECK); break; } } @Inject  ViewMenuBuilder(final TranslationService ts,
                           final MenuItemFactory menuItemFactory); @PostConstruct void setup(); void setModeller(final GuidedDecisionTableModellerView.Presenter modeller); @Override void push(final MenuFactory.CustomMenuBuilder element); @Override MenuItem build(); @Override void onDecisionTableSelectedEvent(final @Observes DecisionTableSelectedEvent event); @Override void onRefreshMenusEvent(final @Observes RefreshMenusEvent event); @Override void initialise(); void onDecisionTablePinnedEvent(final @Observes DecisionTablePinnedEvent event);  }
@Test public void testOnZoom125() { menuItemFactoryViewMocks.stream().forEach(Mockito::reset); builder.onZoom(125); verify(builder.miZoom125pct.getMenuItemView(), times(1)).setIconType(eq(IconType.CHECK)); verify(builder.miZoom100pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom75pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom50pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(modeller, times(1)).setZoom(eq(125)); }
@Test public void testOnZoom100() { menuItemFactoryViewMocks.stream().forEach(Mockito::reset); builder.onZoom(100); verify(builder.miZoom125pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom100pct.getMenuItemView(), times(1)).setIconType(eq(IconType.CHECK)); verify(builder.miZoom75pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom50pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(modeller, times(1)).setZoom(eq(100)); }
@Test public void testOnZoom75() { menuItemFactoryViewMocks.stream().forEach(Mockito::reset); builder.onZoom(75); verify(builder.miZoom125pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom100pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom75pct.getMenuItemView(), times(1)).setIconType(eq(IconType.CHECK)); verify(builder.miZoom50pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(modeller, times(1)).setZoom(eq(75)); }
@Test public void testOnZoom50() { menuItemFactoryViewMocks.stream().forEach(Mockito::reset); builder.onZoom(50); verify(builder.miZoom125pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom100pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom75pct.getMenuItemView(), times(1)).setIconType(eq(null)); verify(builder.miZoom50pct.getMenuItemView(), times(1)).setIconType(eq(IconType.CHECK)); verify(modeller, times(1)).setZoom(eq(50)); }