GridMenu extends ContextAwareMenu { @Override public boolean canHandle(ActionContext context) { Collection<View> selectedManifestations = context.getSelectedManifestations(); return MenuUtil.containsCanvasManifestation(selectedManifestations); } GridMenu(); @Override boolean canHandle(ActionContext context);  }
@SuppressWarnings("serial") @Test public void canHandleTest() { Collection<View> selectedManifestations = new ArrayList<View>(); selectedManifestations.add(mockView); Mockito.when(actionContext.getSelectedManifestations()).thenReturn(selectedManifestations); Assert.assertFalse(gridMenu.canHandle(actionContext)); Assert.assertFalse(windowGridMenu.canHandle(actionContext)); selectedManifestations = new ArrayList<View>(); CanvasManifestation canvasManifestation = new CanvasManifestation(mockComponent, new ViewInfo(CanvasManifestation.class,"",ViewType.CENTER)) { @Override public ExtendedProperties getViewProperties() { return new ExtendedProperties(); } }; selectedManifestations.add(canvasManifestation); Mockito.when(actionContext.getSelectedManifestations()).thenReturn(selectedManifestations); Mockito.when(actionContext.getRootManifestations()).thenReturn(selectedManifestations); Assert.assertTrue(gridMenu.canHandle(actionContext)); Assert.assertTrue(windowGridMenu.canHandle(actionContext)); }