}
assertTrue("No User instance equivalent to u1_1 was found!", found);
}
public void testFindAllByForeignKeyFromSet() throws Exception {
ICommentPersistence comments = dbs.getDatabase1().comments();
comments.deleteAll();
Long userId = 1L;
Long otherUserId = 2L;
Comment c1 = comments.create("comment1", userId.intValue(), 1L, 0);
Comment c2 = comments.create("comment2", userId.intValue(), 1L, 0);
Comment c3 = comments.create("comment3", userId.intValue(), 1L, 0);
Comment c4 = comments.create("comment4", otherUserId.intValue(), 1L, 0);
Comment c5 = comments.create("comment5", 3, 1L, 0);
Set<Long> commenterIds = new HashSet<Long>();
commenterIds.add(userId);
commenterIds.add(otherUserId);
Set<Comment> userComments = comments.findAllByForeignKey("commenter_id", commenterIds);
assertEquals(4, userComments.size());
assertTrue(userComments.contains(c1));
assertTrue(userComments.contains(c2));
assertTrue(userComments.contains(c3));
assertTrue(userComments.contains(c4));
assertFalse(userComments.contains(c5));
Set<Comment> userCommentsSecondQuery = comments.findAllByForeignKey("commenter_id", commenterIds);
assertEquals(4, userCommentsSecondQuery.size());
assertTrue(userCommentsSecondQuery.contains(c1));
assertTrue(userCommentsSecondQuery.contains(c2));
assertTrue(userCommentsSecondQuery.contains(c3));
assertTrue(userCommentsSecondQuery.contains(c4));