@Test(expected = ProtocolException.class) public void testGetActivityNumberFormatException() throws Exception { context.checking(new Expectations() { { allowing(principalDao).execute(USERID_ONE); will(returnValue(principalMock)); allowing(principalMock).getAccountId(); will(returnValue("foo")); oneOf(serviceActionControllerMock).execute(with(any(ServiceActionContext.class)), with(any(ServiceAction.class))); will(throwException(new NumberFormatException())); } }); sut.getActivity(testId, testGroupId, TEST_APP_ID, ACTIVITY_ALL_FIELDS, TEST_ACTIVITY_ID, FAKETOKEN).get(); context.assertIsSatisfied(); }
public Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId, final Set<String> fields, final String activityId, final SecurityToken token) { Set<String> activityIds = new HashSet<String>(); activityIds.add(activityId); Future<RestfulCollection<Activity>> activities = getActivities(userId, groupId, appId, fields, null, activityIds, token); Future<Activity> outActivity = null; try { outActivity = ImmediateFuture.newInstance(activities.get().getEntry().get(0)); } catch (Exception e) { log.error(e); } return outActivity; }
ActivityServiceImpl implements ActivityService { public Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId, final Set<String> fields, final String activityId, final SecurityToken token) { Set<String> activityIds = new HashSet<String>(); activityIds.add(activityId); Future<RestfulCollection<Activity>> activities = getActivities(userId, groupId, appId, fields, null, activityIds, token); Future<Activity> outActivity = null; try { outActivity = ImmediateFuture.newInstance(activities.get().getEntry().get(0)); } catch (Exception e) { log.error(e); } return outActivity; } }
ActivityServiceImpl implements ActivityService { public Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId, final Set<String> fields, final String activityId, final SecurityToken token) { Set<String> activityIds = new HashSet<String>(); activityIds.add(activityId); Future<RestfulCollection<Activity>> activities = getActivities(userId, groupId, appId, fields, null, activityIds, token); Future<Activity> outActivity = null; try { outActivity = ImmediateFuture.newInstance(activities.get().getEntry().get(0)); } catch (Exception e) { log.error(e); } return outActivity; } @Inject  ActivityServiceImpl(@Named("getUserActivities") final ServiceAction inGetUserActivitiesAction,
            @Named("deleteUserActivities") final TaskHandlerAction inDeleteActivitiesAction,
            final ActionController inServiceActionController,
            @Named("openSocialPrincipalDao") final DomainMapper<String, Principal> inOpenSocialPrincipalDao,
            @Named("postPersonActivityServiceActionTaskHandler") final TaskHandlerServiceAction inPostActivityAction,
            @Named("jpaGadgetDefinitionMapper") final GadgetDefinitionMapper inGadgetDefinitionMapper,
            final GadgetMetaDataFetcher inGadgetMetaDataFetcher); }
ActivityServiceImpl implements ActivityService { public Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId, final Set<String> fields, final String activityId, final SecurityToken token) { Set<String> activityIds = new HashSet<String>(); activityIds.add(activityId); Future<RestfulCollection<Activity>> activities = getActivities(userId, groupId, appId, fields, null, activityIds, token); Future<Activity> outActivity = null; try { outActivity = ImmediateFuture.newInstance(activities.get().getEntry().get(0)); } catch (Exception e) { log.error(e); } return outActivity; } @Inject  ActivityServiceImpl(@Named("getUserActivities") final ServiceAction inGetUserActivitiesAction,
            @Named("deleteUserActivities") final TaskHandlerAction inDeleteActivitiesAction,
            final ActionController inServiceActionController,
            @Named("openSocialPrincipalDao") final DomainMapper<String, Principal> inOpenSocialPrincipalDao,
            @Named("postPersonActivityServiceActionTaskHandler") final TaskHandlerServiceAction inPostActivityAction,
            @Named("jpaGadgetDefinitionMapper") final GadgetDefinitionMapper inGadgetDefinitionMapper,
            final GadgetMetaDataFetcher inGadgetMetaDataFetcher); Future<Void> createActivity(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> fields, final Activity activity, final SecurityToken token); Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> activityIds, final SecurityToken token); @SuppressWarnings("unchecked") Future<RestfulCollection<Activity>> getActivities(final Set<UserId> userIds, final GroupId groupId,
            final String appId, final Set<String> fields, final CollectionOptions options, final SecurityToken token); @SuppressWarnings("unchecked") Future<RestfulCollection<Activity>> getActivities(final UserId userId, final GroupId groupId,
            final String appId, final Set<String> fields, final CollectionOptions options,
            final Set<String> activityIds, final SecurityToken token); Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> fields, final String activityId, final SecurityToken token); }
ActivityServiceImpl implements ActivityService { public Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId, final Set<String> fields, final String activityId, final SecurityToken token) { Set<String> activityIds = new HashSet<String>(); activityIds.add(activityId); Future<RestfulCollection<Activity>> activities = getActivities(userId, groupId, appId, fields, null, activityIds, token); Future<Activity> outActivity = null; try { outActivity = ImmediateFuture.newInstance(activities.get().getEntry().get(0)); } catch (Exception e) { log.error(e); } return outActivity; } @Inject  ActivityServiceImpl(@Named("getUserActivities") final ServiceAction inGetUserActivitiesAction,
            @Named("deleteUserActivities") final TaskHandlerAction inDeleteActivitiesAction,
            final ActionController inServiceActionController,
            @Named("openSocialPrincipalDao") final DomainMapper<String, Principal> inOpenSocialPrincipalDao,
            @Named("postPersonActivityServiceActionTaskHandler") final TaskHandlerServiceAction inPostActivityAction,
            @Named("jpaGadgetDefinitionMapper") final GadgetDefinitionMapper inGadgetDefinitionMapper,
            final GadgetMetaDataFetcher inGadgetMetaDataFetcher); Future<Void> createActivity(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> fields, final Activity activity, final SecurityToken token); Future<Void> deleteActivities(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> activityIds, final SecurityToken token); @SuppressWarnings("unchecked") Future<RestfulCollection<Activity>> getActivities(final Set<UserId> userIds, final GroupId groupId,
            final String appId, final Set<String> fields, final CollectionOptions options, final SecurityToken token); @SuppressWarnings("unchecked") Future<RestfulCollection<Activity>> getActivities(final UserId userId, final GroupId groupId,
            final String appId, final Set<String> fields, final CollectionOptions options,
            final Set<String> activityIds, final SecurityToken token); Future<Activity> getActivity(final UserId userId, final GroupId groupId, final String appId,
            final Set<String> fields, final String activityId, final SecurityToken token);  }