@Test public void testObjectToStringFromActivityBookmarkWithContentAndTitle() { HashMap<String, String> baseObject = new HashMap<String, String>(); baseObject.put("content", content); baseObject.put("targetTitle", targetTitle); final Activity activity = new Activity(); activity.setBaseObjectType(BaseObjectType.BOOKMARK); activity.setBaseObject(baseObject); CONTEXT.checking(new Expectations() { { oneOf(commentIdsByActivityIdDAO).execute(activity.getId()); will(returnValue(new ArrayList<Long>())); oneOf(commentsByIdDAO).execute(with(any(ArrayList.class))); will(returnValue(new ArrayList<CommentDTO>())); } }); assertEquals(content + " " + targetTitle + constantKeywordComponent, sut.objectToString(activity).trim()); }
@Override public String objectToString(final Object activityObject) { Activity activity = (Activity) activityObject; List<CommentDTO> commentList = commentsByIdDAO.execute(commentIdsByActivityIdDAO.execute(activity.getId())); final StringBuilder contentAsString = new StringBuilder(); String content = contentExtractor.extractContent(activity.getBaseObjectType(), activity.getBaseObject()); if (null != content) { contentAsString.append(content); } for (CommentDTO comment : commentList) { contentAsString.append(" "); contentAsString.append(comment.getBody()); } contentAsString.append(" "); contentAsString.append(Activity.CONSTANT_KEYWORD_IN_EVERY_ACTIVITY_CONTENT); return contentAsString.toString(); }
ActivityContentClassBridge implements StringBridge { @Override public String objectToString(final Object activityObject) { Activity activity = (Activity) activityObject; List<CommentDTO> commentList = commentsByIdDAO.execute(commentIdsByActivityIdDAO.execute(activity.getId())); final StringBuilder contentAsString = new StringBuilder(); String content = contentExtractor.extractContent(activity.getBaseObjectType(), activity.getBaseObject()); if (null != content) { contentAsString.append(content); } for (CommentDTO comment : commentList) { contentAsString.append(" "); contentAsString.append(comment.getBody()); } contentAsString.append(" "); contentAsString.append(Activity.CONSTANT_KEYWORD_IN_EVERY_ACTIVITY_CONTENT); return contentAsString.toString(); } }
ActivityContentClassBridge implements StringBridge { @Override public String objectToString(final Object activityObject) { Activity activity = (Activity) activityObject; List<CommentDTO> commentList = commentsByIdDAO.execute(commentIdsByActivityIdDAO.execute(activity.getId())); final StringBuilder contentAsString = new StringBuilder(); String content = contentExtractor.extractContent(activity.getBaseObjectType(), activity.getBaseObject()); if (null != content) { contentAsString.append(content); } for (CommentDTO comment : commentList) { contentAsString.append(" "); contentAsString.append(comment.getBody()); } contentAsString.append(" "); contentAsString.append(Activity.CONSTANT_KEYWORD_IN_EVERY_ACTIVITY_CONTENT); return contentAsString.toString(); }  }
ActivityContentClassBridge implements StringBridge { @Override public String objectToString(final Object activityObject) { Activity activity = (Activity) activityObject; List<CommentDTO> commentList = commentsByIdDAO.execute(commentIdsByActivityIdDAO.execute(activity.getId())); final StringBuilder contentAsString = new StringBuilder(); String content = contentExtractor.extractContent(activity.getBaseObjectType(), activity.getBaseObject()); if (null != content) { contentAsString.append(content); } for (CommentDTO comment : commentList) { contentAsString.append(" "); contentAsString.append(comment.getBody()); } contentAsString.append(" "); contentAsString.append(Activity.CONSTANT_KEYWORD_IN_EVERY_ACTIVITY_CONTENT); return contentAsString.toString(); }  static void setCommentDAOs(final DomainMapper<Long, List<Long>> inCommentIdsByActivityIdDAO,
            final DomainMapper<List<Long>, List<CommentDTO>> inCommentsByIdDAO); @Override String objectToString(final Object activityObject); }
ActivityContentClassBridge implements StringBridge { @Override public String objectToString(final Object activityObject) { Activity activity = (Activity) activityObject; List<CommentDTO> commentList = commentsByIdDAO.execute(commentIdsByActivityIdDAO.execute(activity.getId())); final StringBuilder contentAsString = new StringBuilder(); String content = contentExtractor.extractContent(activity.getBaseObjectType(), activity.getBaseObject()); if (null != content) { contentAsString.append(content); } for (CommentDTO comment : commentList) { contentAsString.append(" "); contentAsString.append(comment.getBody()); } contentAsString.append(" "); contentAsString.append(Activity.CONSTANT_KEYWORD_IN_EVERY_ACTIVITY_CONTENT); return contentAsString.toString(); }  static void setCommentDAOs(final DomainMapper<Long, List<Long>> inCommentIdsByActivityIdDAO,
            final DomainMapper<List<Long>, List<CommentDTO>> inCommentsByIdDAO); @Override String objectToString(final Object activityObject);  }