@Test public void approveDoesNotHaveRequiredRoleShouldIgnore() { when(roleManager.getCanApproveMessages()).thenReturn(false); when(mockResult.redirectTo(ForumController.class)).thenReturn(mockForumController); controller.approve(1, Arrays.asList(new ApproveInfo[0])); verify(mockForumController).show(1, 0); }
@Test public void approveExpectSuccess() { when(roleManager.getCanApproveMessages()).thenReturn(true); when(mockResult.redirectTo(ForumController.class)).thenReturn(mockForumController); controller.approve(1, Arrays.asList(new ApproveInfo[0])); verify(service).doApproval(1, Arrays.asList(new ApproveInfo[0])); // TODO pass zero? verify(mockForumController).show(1, 0); }