NewCaseProjectHandler implements NewWorkspaceProjectHandler { @Override public boolean canCreate() { return projectController.canCreateProjects(context.getActiveOrganizationalUnit().get()); }  @Inject void setCaseProjectService(Caller<CaseProjectService> caseProjectService); @Inject void setNotification(Event<NotificationEvent> notification); @Inject void setAddProjectPopUpPresenterProvider(Instance<AddProjectPopUpPresenter> addProjectPopUpPresenterProvider); @Override List<Pair<String, ? extends IsWidget>> getExtensions(); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override boolean canCreate(); @Override void create(final Package pkg,
                       final String projectName,
                       final NewResourcePresenter presenter); @Override void validate(final String projectName,
                         final ValidatorWithReasonCallback callback); @Override void acceptContext(final Callback<Boolean, Void> response); @Override Command getCommand(final NewResourcePresenter newResourcePresenter); @Override void setOpenEditorOnCreation(final boolean openEditorOnCreation); @Override void setCreationSuccessCallback(org.uberfire.client.callbacks.Callback<WorkspaceProject> creationSuccessCallback); @Override boolean isProjectAsset();  }
@Test public void testCanCreateCaseProjectWhenUserHasPermissionOnCurrentOU() { final OrganizationalUnit currentOU = mock(OrganizationalUnit.class); doReturn(Optional.of(currentOU)).when(context).getActiveOrganizationalUnit(); doReturn(true).when(projectController).canCreateProjects(same(currentOU)); assertTrue(newCaseProjectHandler.canCreate()); }
@Test public void testCanNotCreateCaseProjectWhenUserHasNoPermissionOnCurrentOU() { final OrganizationalUnit currentOU = mock(OrganizationalUnit.class); doReturn(Optional.of(currentOU)).when(context).getActiveOrganizationalUnit(); doReturn(false).when(projectController).canCreateProjects(same(currentOU)); assertFalse(newCaseProjectHandler.canCreate()); }