### Question:
CaseManagementDiagramNewResourceHandler extends AbstractProjectDiagramNewResourceHandler<CaseManagementDiagramResourceType> { @Override public boolean canCreate() { return authorizationManager.authorize(new ResourceRef(CaseManagementDiagramEditor.EDITOR_ID, ActivityResourceType.EDITOR), ResourceAction.READ, sessionInfo.getIdentity()); } protected  CaseManagementDiagramNewResourceHandler(); @Inject  CaseManagementDiagramNewResourceHandler(final DefinitionManager definitionManager,
                                                   final ClientProjectDiagramService projectDiagramServices,
                                                   final BusyIndicatorView indicatorView,
                                                   final CaseManagementDiagramResourceType projectDiagramResourceType,
                                                   final AuthorizationManager authorizationManager,
                                                   final SessionInfo sessionInfo,
                                                   final CaseHelper caseHelper); @Override String getDescription(); @Override IsWidget getIcon(); @Override boolean canCreate(); @Override List<Profile> getProfiles(); @Override void createDiagram(Package pkg, String name, NewResourcePresenter presenter, Path path, String setId,
                              String moduleName, Optional<String> projectType); @Override void acceptContext(Callback<Boolean, Void> callback);  }### Answer:
@Test public void testCanCreate_disabled() { when(authorizationManager.authorize(any(ResourceRef.class), eq(ResourceAction.READ), eq(user))).thenReturn(false); assertFalse(tested.canCreate()); }
@Test public void testCanCreate_enabled() { when(authorizationManager.authorize(any(ResourceRef.class), eq(ResourceAction.READ), eq(user))).thenReturn(true); assertTrue(tested.canCreate()); }
@Test public void checkCanCreateWhenFeatureDisabled() { when(authorizationManager.authorize(any(ResourceRef.class), eq(ResourceAction.READ), eq(user))).thenReturn(false); assertFalse(tested.canCreate()); assertResourceRef(); }
@Test public void checkCanCreateWhenFeatureEnabled() { when(authorizationManager.authorize(any(ResourceRef.class), eq(ResourceAction.READ), eq(user))).thenReturn(true); assertTrue(tested.canCreate()); assertResourceRef(); }