@Test public void transformTestNotMatchingId() { final Long entityId = 10L; final String entityAcctName = "acctName"; final JSONObject jsonReq = new JSONObject(); jsonReq.accumulate("joinedGroups", entityAcctName); context.checking(new Expectations() { { oneOf(getPersonIdByAccountId).execute(entityAcctName); will(returnValue(entityId - 1L)); } }); List<Long> groups = (List<Long>) sut.transform(jsonReq, entityId); Assert.assertEquals(0, groups.size()); context.assertIsSatisfied(); }
@Override public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString("joinedGroups"); Long requestAccountId = getPersonIdByAccountId.execute(accountId); ArrayList<Long> results = new ArrayList<Long>(); if (userEntityId.equals(requestAccountId)) { List<Long> groupIds = followedGroupsMapper.execute(requestAccountId); List<DomainGroupModelView> groupList = groupMapper.execute(groupIds); for (DomainGroupModelView group : groupList) { results.add(group.getStreamId()); } } return results; }
FollowedGroupsPersistenceRequestTransformer implements PersistenceDataSourceRequestTransformer { @Override public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString("joinedGroups"); Long requestAccountId = getPersonIdByAccountId.execute(accountId); ArrayList<Long> results = new ArrayList<Long>(); if (userEntityId.equals(requestAccountId)) { List<Long> groupIds = followedGroupsMapper.execute(requestAccountId); List<DomainGroupModelView> groupList = groupMapper.execute(groupIds); for (DomainGroupModelView group : groupList) { results.add(group.getStreamId()); } } return results; } }
FollowedGroupsPersistenceRequestTransformer implements PersistenceDataSourceRequestTransformer { @Override public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString("joinedGroups"); Long requestAccountId = getPersonIdByAccountId.execute(accountId); ArrayList<Long> results = new ArrayList<Long>(); if (userEntityId.equals(requestAccountId)) { List<Long> groupIds = followedGroupsMapper.execute(requestAccountId); List<DomainGroupModelView> groupList = groupMapper.execute(groupIds); for (DomainGroupModelView group : groupList) { results.add(group.getStreamId()); } } return results; } FollowedGroupsPersistenceRequestTransformer(final DomainMapper<String, Long> inGetPersonIdByAccountId,
            final DomainMapper<Long, List<Long>> inFolloweGroupsMapper,
            final DomainMapper<List<Long>, List<DomainGroupModelView>> inGroupMapper); }
FollowedGroupsPersistenceRequestTransformer implements PersistenceDataSourceRequestTransformer { @Override public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString("joinedGroups"); Long requestAccountId = getPersonIdByAccountId.execute(accountId); ArrayList<Long> results = new ArrayList<Long>(); if (userEntityId.equals(requestAccountId)) { List<Long> groupIds = followedGroupsMapper.execute(requestAccountId); List<DomainGroupModelView> groupList = groupMapper.execute(groupIds); for (DomainGroupModelView group : groupList) { results.add(group.getStreamId()); } } return results; } FollowedGroupsPersistenceRequestTransformer(final DomainMapper<String, Long> inGetPersonIdByAccountId,
            final DomainMapper<Long, List<Long>> inFolloweGroupsMapper,
            final DomainMapper<List<Long>, List<DomainGroupModelView>> inGroupMapper); @Override Serializable transform(final JSONObject request, final Long userEntityId); }
FollowedGroupsPersistenceRequestTransformer implements PersistenceDataSourceRequestTransformer { @Override public Serializable transform(final JSONObject request, final Long userEntityId) { String accountId = request.getString("joinedGroups"); Long requestAccountId = getPersonIdByAccountId.execute(accountId); ArrayList<Long> results = new ArrayList<Long>(); if (userEntityId.equals(requestAccountId)) { List<Long> groupIds = followedGroupsMapper.execute(requestAccountId); List<DomainGroupModelView> groupList = groupMapper.execute(groupIds); for (DomainGroupModelView group : groupList) { results.add(group.getStreamId()); } } return results; } FollowedGroupsPersistenceRequestTransformer(final DomainMapper<String, Long> inGetPersonIdByAccountId,
            final DomainMapper<Long, List<Long>> inFolloweGroupsMapper,
            final DomainMapper<List<Long>, List<DomainGroupModelView>> inGroupMapper); @Override Serializable transform(final JSONObject request, final Long userEntityId);  }