@Test public void testExecute() { final Collection<Long> items = Arrays.asList(1L, 2L, 3L); final long userId = 77L; final UnreadInAppNotificationCountDTO newCount = new UnreadInAppNotificationCountDTO(4, 6); final InAppNotificationsByUserMapperRequest expectedRequest = new InAppNotificationsByUserMapperRequest(items, userId); context.checking(new Expectations() { { oneOf(modifyNotifsMapper).execute(with(equalInternally(expectedRequest))); oneOf(syncMapper).execute(userId); will(returnValue(newCount)); } }); PrincipalActionContext ctx = TestContextCreator.createPrincipalActionContext((Serializable) items, "whomever", userId); assertTrue(IsEqualInternally.areEqualInternally(newCount, sut.execute(ctx))); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) { Collection<Long> notifIds = (Collection<Long>) inActionContext.getParams(); long userId = inActionContext.getPrincipal().getId(); modifyNotifsMapper.execute(new InAppNotificationsByUserMapperRequest(notifIds, userId)); UnreadInAppNotificationCountDTO newCounts = syncMapper.execute(userId); return newCounts; }
ModifyInAppNotificationsExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { Collection<Long> notifIds = (Collection<Long>) inActionContext.getParams(); long userId = inActionContext.getPrincipal().getId(); modifyNotifsMapper.execute(new InAppNotificationsByUserMapperRequest(notifIds, userId)); UnreadInAppNotificationCountDTO newCounts = syncMapper.execute(userId); return newCounts; } }
ModifyInAppNotificationsExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { Collection<Long> notifIds = (Collection<Long>) inActionContext.getParams(); long userId = inActionContext.getPrincipal().getId(); modifyNotifsMapper.execute(new InAppNotificationsByUserMapperRequest(notifIds, userId)); UnreadInAppNotificationCountDTO newCounts = syncMapper.execute(userId); return newCounts; } ModifyInAppNotificationsExecution(
            final DomainMapper<InAppNotificationsByUserMapperRequest, Serializable> inModifyNotifsMapper,
            final DomainMapper<Long, UnreadInAppNotificationCountDTO> inSyncMapper); }
ModifyInAppNotificationsExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { Collection<Long> notifIds = (Collection<Long>) inActionContext.getParams(); long userId = inActionContext.getPrincipal().getId(); modifyNotifsMapper.execute(new InAppNotificationsByUserMapperRequest(notifIds, userId)); UnreadInAppNotificationCountDTO newCounts = syncMapper.execute(userId); return newCounts; } ModifyInAppNotificationsExecution(
            final DomainMapper<InAppNotificationsByUserMapperRequest, Serializable> inModifyNotifsMapper,
            final DomainMapper<Long, UnreadInAppNotificationCountDTO> inSyncMapper); @Override Serializable execute(final PrincipalActionContext inActionContext); }
ModifyInAppNotificationsExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { Collection<Long> notifIds = (Collection<Long>) inActionContext.getParams(); long userId = inActionContext.getPrincipal().getId(); modifyNotifsMapper.execute(new InAppNotificationsByUserMapperRequest(notifIds, userId)); UnreadInAppNotificationCountDTO newCounts = syncMapper.execute(userId); return newCounts; } ModifyInAppNotificationsExecution(
            final DomainMapper<InAppNotificationsByUserMapperRequest, Serializable> inModifyNotifsMapper,
            final DomainMapper<Long, UnreadInAppNotificationCountDTO> inSyncMapper); @Override Serializable execute(final PrincipalActionContext inActionContext);  }