public String toString() { return new ToStringBuilder(this).append("userId", getUserId()) .append("commentDate", getCommentDate()).toString(); }
public boolean equals(Object other) { if ((this == other)) { return true; } if (!(other instanceof TimesheetCommentId)) { return false; } TimesheetCommentId castOther = (TimesheetCommentId) other; return new EqualsBuilder().append(this.getUserId(), castOther.getUserId()).append(this.getCommentDate(), castOther.getCommentDate()).isEquals(); }
public int hashCode() { return new HashCodeBuilder().append(getUserId()).append(getCommentDate()).toHashCode(); }
@Test public void should_find_entries_in_range_for_users() { Interval i = new Interval(new LocalDate(2007, DateTimeConstants.JANUARY, 1).toDateTimeAtCurrentTime(), new LocalDate(2007, DateTimeConstants.JANUARY, 30).toDateTimeAtCurrentTime()); List<TimesheetComment> comments = timesheetCommentDao.findCommentBetweenForUsers(Lists.newArrayList(2, 3), new DateRange(i)); assertEquals(2, comments.get(0).getCommentId().getUserId().intValue()); assertEquals(3, comments.get(1).getCommentId().getUserId().intValue()); } }