@Test public void testObjectToStringForGroupFromActivityObject() { context.checking(new Expectations() { { oneOf(getDomainGroupsByShortNamesMock).fetchId(testDomainGroupShortName); will(returnValue(testDomainGroupId)); } }); Activity activity = new Activity(); activity.setActorType(EntityType.GROUP); activity.setActorId(testDomainGroupShortName); assertEquals("g" + testDomainGroupId, sut.objectToString(activity)); context.assertIsSatisfied(); }
@Override public String objectToString(final Object msgObject) { Activity activity = (Activity) msgObject; EntityType actorType = activity.getActorType(); String result = null; switch (actorType) { case GROUP: result = "g" + getDomainGroupsByShortNames.fetchId(activity.getActorId()); break; case PERSON: result = "p" + getPersonIdByAccountIdMapper.execute(activity.getActorId()); break; default: throw new RuntimeException("Unknown/unhandled recipient type: " + actorType); } if (log.isInfoEnabled()) { log.info("Bridge converted activity with actorId " + activity.getActorId() + " to " + result); } return result; }
ActivityAuthorClassBridge implements StringBridge { @Override public String objectToString(final Object msgObject) { Activity activity = (Activity) msgObject; EntityType actorType = activity.getActorType(); String result = null; switch (actorType) { case GROUP: result = "g" + getDomainGroupsByShortNames.fetchId(activity.getActorId()); break; case PERSON: result = "p" + getPersonIdByAccountIdMapper.execute(activity.getActorId()); break; default: throw new RuntimeException("Unknown/unhandled recipient type: " + actorType); } if (log.isInfoEnabled()) { log.info("Bridge converted activity with actorId " + activity.getActorId() + " to " + result); } return result; } }
ActivityAuthorClassBridge implements StringBridge { @Override public String objectToString(final Object msgObject) { Activity activity = (Activity) msgObject; EntityType actorType = activity.getActorType(); String result = null; switch (actorType) { case GROUP: result = "g" + getDomainGroupsByShortNames.fetchId(activity.getActorId()); break; case PERSON: result = "p" + getPersonIdByAccountIdMapper.execute(activity.getActorId()); break; default: throw new RuntimeException("Unknown/unhandled recipient type: " + actorType); } if (log.isInfoEnabled()) { log.info("Bridge converted activity with actorId " + activity.getActorId() + " to " + result); } return result; }  }
ActivityAuthorClassBridge implements StringBridge { @Override public String objectToString(final Object msgObject) { Activity activity = (Activity) msgObject; EntityType actorType = activity.getActorType(); String result = null; switch (actorType) { case GROUP: result = "g" + getDomainGroupsByShortNames.fetchId(activity.getActorId()); break; case PERSON: result = "p" + getPersonIdByAccountIdMapper.execute(activity.getActorId()); break; default: throw new RuntimeException("Unknown/unhandled recipient type: " + actorType); } if (log.isInfoEnabled()) { log.info("Bridge converted activity with actorId " + activity.getActorId() + " to " + result); } return result; }  @Override String objectToString(final Object msgObject); static void setGetDomainGroupsByShortNames(final GetDomainGroupsByShortNames inGetDomainGroupsByShortNames); static void setGetPersonIdByAccountIdMapper(final DomainMapper<String, Long> inGetPersonIdByAccountIdMapper); }
ActivityAuthorClassBridge implements StringBridge { @Override public String objectToString(final Object msgObject) { Activity activity = (Activity) msgObject; EntityType actorType = activity.getActorType(); String result = null; switch (actorType) { case GROUP: result = "g" + getDomainGroupsByShortNames.fetchId(activity.getActorId()); break; case PERSON: result = "p" + getPersonIdByAccountIdMapper.execute(activity.getActorId()); break; default: throw new RuntimeException("Unknown/unhandled recipient type: " + actorType); } if (log.isInfoEnabled()) { log.info("Bridge converted activity with actorId " + activity.getActorId() + " to " + result); } return result; }  @Override String objectToString(final Object msgObject); static void setGetDomainGroupsByShortNames(final GetDomainGroupsByShortNames inGetDomainGroupsByShortNames); static void setGetPersonIdByAccountIdMapper(final DomainMapper<String, Long> inGetPersonIdByAccountIdMapper);  }