/** Tests execute. */ @Test public void testExecuteNoPeople() { context.checking( new Expectations() { { oneOf(createNotificationsMapper).execute(request); will(returnValue(0)); } }); TaskHandlerActionContext<PrincipalActionContext> actionContext = TestContextCreator.createTaskHandlerContextWithPrincipal(request, null); Serializable result = sut.execute(actionContext); context.assertIsSatisfied(); assertEquals(0, result); assertTrue(actionContext.getUserActionRequests().isEmpty()); }
/** Tests execute. */ @Test public void testExecute() { context.checking( new Expectations() { { oneOf(createNotificationsMapper).execute(request); will(returnValue(5)); oneOf(unlockedUsersMapper).execute(false); will(returnValue(Arrays.asList(5L, 6L, 7L, 8L, 9L))); } }); TaskHandlerActionContext<PrincipalActionContext> actionContext = TestContextCreator.createTaskHandlerContextWithPrincipal(request, null); Serializable result = sut.execute(actionContext); context.assertIsSatisfied(); assertEquals(5, result); assertEquals(5, actionContext.getUserActionRequests().size()); for (UserActionRequest rqst : actionContext.getUserActionRequests()) { assertEquals("refreshUserInAppNotificationCounts", rqst.getActionKey()); } }