@Test public void lockUnlockDoesNotHaveRoleShouldIgnore() { when(roleManager.getCanLockUnlockTopics()).thenReturn(false); when(mockResult.redirectTo(ForumController.class)).thenReturn(mockForumController); controller.lockUnlock(1, null, moderationLog, new int[] {1}); verify(mockForumController).show(1, 0); }
@Test public void lockUnlock() { when(userSession.getUser()).thenReturn(user); when(roleManager.getCanLockUnlockTopics()).thenReturn(true); when(mockResult.redirectTo(ForumController.class)).thenReturn(mockForumController); controller.lockUnlock(1, null, moderationLog, new int[] {1, 2, 3}); verify(service).lockUnlock(new int[] {1, 2, 3}, moderationLog); verify(mockForumController).show(1, 0); }