SimpleListElementAction extends ProjectAction { @Override protected void updateProjectAction(ActionEvent event) { CurrentProject currentProject = appContext.getCurrentProject(); event.getPresentation().setEnabledAndVisible(currentProject != null); } @AssistedInject  SimpleListElementAction(AppContext appContext,
                                   @NotNull @Assisted String name,
                                   @NotNull @Assisted SVGResource image,
                                   @NotNull @Assisted DropDownHeaderWidget header); @Override void actionPerformed(ActionEvent e); @NotNull String getName(); @NotNull SVGResource getImage();  }
@Test public void projectActionShouldBeUpdated() throws Exception { CurrentProject currentProject = mock(CurrentProject.class); when(appContext.getCurrentProject()).thenReturn(currentProject); action.updateProjectAction(actionEvent); verify(presentation).setEnabledAndVisible(true); }
@Test public void projectActionShouldNotBeUpdatedIfCurrentProjectIsNull() throws Exception { when(appContext.getCurrentProject()).thenReturn(null); action.updateProjectAction(actionEvent); verify(presentation).setEnabledAndVisible(false); }