### Question:
BPMNDiagramNewResourceHandler extends AbstractProjectDiagramNewResourceHandler<BPMNDiagramResourceType> { @Override public boolean canCreate() { return authorizationManager.authorize(new ResourceRef(BPMNDiagramEditor.EDITOR_ID, ActivityResourceType.EDITOR), ResourceAction.READ, sessionInfo.getIdentity()); } protected  BPMNDiagramNewResourceHandler(); @Inject  BPMNDiagramNewResourceHandler(final DefinitionManager definitionManager,
                                         final ClientProjectDiagramService projectDiagramServices,
                                         final BusyIndicatorView indicatorView,
                                         final BPMNDiagramResourceType projectDiagramResourceType,
                                         final AuthorizationManager authorizationManager,
                                         final SessionInfo sessionInfo); @Override String getDescription(); @Override IsWidget getIcon(); @Override boolean canCreate();  }### Answer:
@Test public void checkCanCreateWhenFeatureDisabled() { when(authorizationManager.authorize(any(ResourceRef.class), eq(ResourceAction.READ), eq(user))).thenReturn(false); assertFalse(handler.canCreate()); assertResourceRef(); }
@Test public void checkCanCreateWhenFeatureEnabled() { when(authorizationManager.authorize(any(ResourceRef.class), eq(ResourceAction.READ), eq(user))).thenReturn(true); assertTrue(handler.canCreate()); assertResourceRef(); }