@Test public void testObjectToStringForGroupFromActivityObject() { context.checking(new Expectations() { { oneOf(getDomainGroupsByShortNamesMock).fetchId(testDomainGroupShortName); will(returnValue(testDomainGroupId)); } }); Activity activity = new Activity(); activity.setRecipientStreamScope(new StreamScope(ScopeType.GROUP, testDomainGroupShortName)); assertEquals("g" + testDomainGroupId, sut.objectToString(activity)); context.assertIsSatisfied(); }
@Override public String objectToString(final Object msgObject) { if (getPersonIdByAccountIdMapper == null) { throw new RuntimeException("Person Cache was not set in the MessageRecipientIdClassBridge."); } if (getDomainGroupsByShortNames == null) { throw new RuntimeException("getDomainGroupsByShortNames was not set in the MessageRecipientIdClassBridge."); } Activity activity = (Activity) msgObject; StreamScope scope = activity.getRecipientStreamScope(); switch (scope.getScopeType()) { case GROUP: return "g" + getDomainGroupsByShortNames.fetchId(scope.getUniqueKey()); case PERSON: return "p" + getPersonIdByAccountIdMapper.execute(scope.getUniqueKey()); case RESOURCE: return "r" + getSharedResourceByUniqueKeyMapper.execute( new SharedResourceRequest(scope.getUniqueKey(), null)).getId(); default: throw new RuntimeException("Unknown/unhandled recipient type: " + scope.getScopeType()); } }
ActivityRecipientClassBridge implements StringBridge { @Override public String objectToString(final Object msgObject) { if (getPersonIdByAccountIdMapper == null) { throw new RuntimeException("Person Cache was not set in the MessageRecipientIdClassBridge."); } if (getDomainGroupsByShortNames == null) { throw new RuntimeException("getDomainGroupsByShortNames was not set in the MessageRecipientIdClassBridge."); } Activity activity = (Activity) msgObject; StreamScope scope = activity.getRecipientStreamScope(); switch (scope.getScopeType()) { case GROUP: return "g" + getDomainGroupsByShortNames.fetchId(scope.getUniqueKey()); case PERSON: return "p" + getPersonIdByAccountIdMapper.execute(scope.getUniqueKey()); case RESOURCE: return "r" + getSharedResourceByUniqueKeyMapper.execute( new SharedResourceRequest(scope.getUniqueKey(), null)).getId(); default: throw new RuntimeException("Unknown/unhandled recipient type: " + scope.getScopeType()); } } }
ActivityRecipientClassBridge implements StringBridge { @Override public String objectToString(final Object msgObject) { if (getPersonIdByAccountIdMapper == null) { throw new RuntimeException("Person Cache was not set in the MessageRecipientIdClassBridge."); } if (getDomainGroupsByShortNames == null) { throw new RuntimeException("getDomainGroupsByShortNames was not set in the MessageRecipientIdClassBridge."); } Activity activity = (Activity) msgObject; StreamScope scope = activity.getRecipientStreamScope(); switch (scope.getScopeType()) { case GROUP: return "g" + getDomainGroupsByShortNames.fetchId(scope.getUniqueKey()); case PERSON: return "p" + getPersonIdByAccountIdMapper.execute(scope.getUniqueKey()); case RESOURCE: return "r" + getSharedResourceByUniqueKeyMapper.execute( new SharedResourceRequest(scope.getUniqueKey(), null)).getId(); default: throw new RuntimeException("Unknown/unhandled recipient type: " + scope.getScopeType()); } }  }
ActivityRecipientClassBridge implements StringBridge { @Override public String objectToString(final Object msgObject) { if (getPersonIdByAccountIdMapper == null) { throw new RuntimeException("Person Cache was not set in the MessageRecipientIdClassBridge."); } if (getDomainGroupsByShortNames == null) { throw new RuntimeException("getDomainGroupsByShortNames was not set in the MessageRecipientIdClassBridge."); } Activity activity = (Activity) msgObject; StreamScope scope = activity.getRecipientStreamScope(); switch (scope.getScopeType()) { case GROUP: return "g" + getDomainGroupsByShortNames.fetchId(scope.getUniqueKey()); case PERSON: return "p" + getPersonIdByAccountIdMapper.execute(scope.getUniqueKey()); case RESOURCE: return "r" + getSharedResourceByUniqueKeyMapper.execute( new SharedResourceRequest(scope.getUniqueKey(), null)).getId(); default: throw new RuntimeException("Unknown/unhandled recipient type: " + scope.getScopeType()); } }  @Override String objectToString(final Object msgObject); static void setGetDomainGroupsByShortNames(final GetDomainGroupsByShortNames inGetDomainGroupsByShortNames); static void setGetPersonIdByAccountIdMapper(final DomainMapper<String, Long> inGetPersonIdByAccountIdMapper); static void setGetSharedResourceByUniqueKeyMapper(
            final DomainMapper<SharedResourceRequest, SharedResource> inGetSharedResourceByUniqueKeyMapper); }
ActivityRecipientClassBridge implements StringBridge { @Override public String objectToString(final Object msgObject) { if (getPersonIdByAccountIdMapper == null) { throw new RuntimeException("Person Cache was not set in the MessageRecipientIdClassBridge."); } if (getDomainGroupsByShortNames == null) { throw new RuntimeException("getDomainGroupsByShortNames was not set in the MessageRecipientIdClassBridge."); } Activity activity = (Activity) msgObject; StreamScope scope = activity.getRecipientStreamScope(); switch (scope.getScopeType()) { case GROUP: return "g" + getDomainGroupsByShortNames.fetchId(scope.getUniqueKey()); case PERSON: return "p" + getPersonIdByAccountIdMapper.execute(scope.getUniqueKey()); case RESOURCE: return "r" + getSharedResourceByUniqueKeyMapper.execute( new SharedResourceRequest(scope.getUniqueKey(), null)).getId(); default: throw new RuntimeException("Unknown/unhandled recipient type: " + scope.getScopeType()); } }  @Override String objectToString(final Object msgObject); static void setGetDomainGroupsByShortNames(final GetDomainGroupsByShortNames inGetDomainGroupsByShortNames); static void setGetPersonIdByAccountIdMapper(final DomainMapper<String, Long> inGetPersonIdByAccountIdMapper); static void setGetSharedResourceByUniqueKeyMapper(
            final DomainMapper<SharedResourceRequest, SharedResource> inGetSharedResourceByUniqueKeyMapper);  }