IdeaEntity { public static IdeaEntity createIdeaEntity(IdeaIn cmd, String campaignId, UserEntity creator) { hasText(campaignId, "campaignId must be given"); hasText(cmd.getTitle(), "Title must contain text."); hasText(cmd.getPitch(), "Pitch must contain text."); notNull(creator, "Creator must not be null."); final IdeaEntity result = new IdeaEntity(); result.setContentI18n(new IdeaContentI18nMap(cmd.getTitle(), cmd.getPitch())); result.setCreator(creator); result.setStatus(IdeaStatus.PROPOSED); result.setCampaignId(campaignId); return result; } private  IdeaEntity(); static IdeaEntity createIdeaEntity(IdeaIn cmd, String campaignId, UserEntity creator); void approveIdea(UserEntity approvingAdmin); void rejectIdea(UserEntity approvingAdmin, String rejectionComment); VoteEntity vote(UserEntity voter, int vote); Rating calculateRating(Collection<VoteEntity> votes, UserEntity requestingUser); String getId(); void setId(String id); IdeaContentI18nMap getContentI18n(); void setContentI18n(IdeaContentI18nMap contentI18n); IdeaStatus getStatus(); void setStatus(IdeaStatus status); String getRejectionComment(); void setRejectionComment(String rejectionComment); DateTime getCreatedDate(); void setCreatedDate(DateTime createdDate); DateTime getLastModifiedDate(); void setLastModifiedDate(DateTime lastModifiedDate); DateTime getReviewDate(); void setReviewDate(DateTime reviewDate); UserEntity getCreator(); void setCreator(UserEntity creator); String getCampaignId(); String getApprovingAdminId(); void setApprovingAdminId(String approvingAdminId); String getOriginalTitle(); String getOriginalPitch(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test(expected = IllegalArgumentException.class) public void createIdeaEntity_shouldFail_on_creator_is_null() { final IdeaIn ideaCommand = new IdeaIn("test_title", "Make more placstic forks!"); IdeaEntity.createIdeaEntity(ideaCommand, EXP_CAMPAIGN_ID, null); }
@Test(expected = IllegalArgumentException.class) public void createIdeaEntity_shouldFail_on_pitch_is_empty() { final IdeaIn ideaCommand = new IdeaIn("test_title", " "); IdeaEntity.createIdeaEntity(ideaCommand, EXP_CAMPAIGN_ID, INITIATOR); }
@Test(expected = IllegalArgumentException.class) public void createIdeaEntity_shouldFail_on_campaignId_isEmpty() { final IdeaIn ideaCommand = new IdeaIn("test_title", " "); IdeaEntity.createIdeaEntity(ideaCommand, " ", INITIATOR); }
@Test(expected = IllegalArgumentException.class) public void createIdeaEntity_shouldFail_on_title_isEmpty() { final IdeaIn ideaCommand = new IdeaIn("", "Make more placstic forks!"); IdeaEntity.createIdeaEntity(ideaCommand, EXP_CAMPAIGN_ID, INITIATOR); }