@Test public void saveNotificationPreferencesForCurrentWikiWithoutRight() throws Exception { when(documentAccessBridge.getCurrentDocumentReference()).thenReturn( new DocumentReference("wikiA", "SpaceA", "PageA")); AccessDeniedException e = mock(AccessDeniedException.class); doThrow(e).when(authorizationManager).checkAccess(Right.ADMIN, new WikiReference("wikiA")); String json = ""; Exception caughtException = null; try { mocker.getComponentUnderTest().saveNotificationPreferencesForCurrentWiki(json); } catch (Exception ex) { caughtException = ex; } assertNotNull(caughtException); assertEquals(e, caughtException); }
public void saveNotificationPreferencesForCurrentWiki(String json) throws NotificationException, AccessDeniedException { WikiReference currentWiki = documentAccessBridge.getCurrentDocumentReference().getWikiReference(); authorizationManager.checkAccess(Right.ADMIN, currentWiki); saveNotificationPreferences(json, WikiNotificationPreferenceProvider.NAME, currentWiki, NotificationPreferenceCategory.SYSTEM); }
NotificationPreferenceScriptService implements ScriptService { public void saveNotificationPreferencesForCurrentWiki(String json) throws NotificationException, AccessDeniedException { WikiReference currentWiki = documentAccessBridge.getCurrentDocumentReference().getWikiReference(); authorizationManager.checkAccess(Right.ADMIN, currentWiki); saveNotificationPreferences(json, WikiNotificationPreferenceProvider.NAME, currentWiki, NotificationPreferenceCategory.SYSTEM); } }
NotificationPreferenceScriptService implements ScriptService { public void saveNotificationPreferencesForCurrentWiki(String json) throws NotificationException, AccessDeniedException { WikiReference currentWiki = documentAccessBridge.getCurrentDocumentReference().getWikiReference(); authorizationManager.checkAccess(Right.ADMIN, currentWiki); saveNotificationPreferences(json, WikiNotificationPreferenceProvider.NAME, currentWiki, NotificationPreferenceCategory.SYSTEM); }  }
NotificationPreferenceScriptService implements ScriptService { public void saveNotificationPreferencesForCurrentWiki(String json) throws NotificationException, AccessDeniedException { WikiReference currentWiki = documentAccessBridge.getCurrentDocumentReference().getWikiReference(); authorizationManager.checkAccess(Right.ADMIN, currentWiki); saveNotificationPreferences(json, WikiNotificationPreferenceProvider.NAME, currentWiki, NotificationPreferenceCategory.SYSTEM); }  void saveNotificationPreferences(String json, DocumentReference userReference); void saveNotificationPreferences(String json); void saveNotificationPreferencesForCurrentWiki(String json); void setStartDate(Date startDate); void setStartDate(String userId, Date startDate); boolean hasAnyEnabledNotificationPreferences(); NotificationEmailDiffType getDiffType(); NotificationEmailDiffType getDiffType(String userId); boolean isEventTypeEnabled(String eventType, NotificationFormat format, String wiki); boolean isEventTypeEnabled(String eventType, NotificationFormat format); }
NotificationPreferenceScriptService implements ScriptService { public void saveNotificationPreferencesForCurrentWiki(String json) throws NotificationException, AccessDeniedException { WikiReference currentWiki = documentAccessBridge.getCurrentDocumentReference().getWikiReference(); authorizationManager.checkAccess(Right.ADMIN, currentWiki); saveNotificationPreferences(json, WikiNotificationPreferenceProvider.NAME, currentWiki, NotificationPreferenceCategory.SYSTEM); }  void saveNotificationPreferences(String json, DocumentReference userReference); void saveNotificationPreferences(String json); void saveNotificationPreferencesForCurrentWiki(String json); void setStartDate(Date startDate); void setStartDate(String userId, Date startDate); boolean hasAnyEnabledNotificationPreferences(); NotificationEmailDiffType getDiffType(); NotificationEmailDiffType getDiffType(String userId); boolean isEventTypeEnabled(String eventType, NotificationFormat format, String wiki); boolean isEventTypeEnabled(String eventType, NotificationFormat format);  }