Thread:
 Unit Tests 
 cote   22 Sep 2004, 07:06 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: cote (22 Sep 2004, 07:06) Replies: 0, Views: 37255
Subject: Unit Tests
When using collections in Hibernate, specifically bags for many-to-many
relationships, what's the best way to go about getting assertEquals to work.

For example, if how could I get simple "see if updating works" code
along the lines of the below to pass the final assertEquals?

List children = new ArrayList(2);
children.add(child1);
children.add(child2);
parent.setChildren(children);
parent.addChild(child2);

Parent stored = session.find("from Parent where id='dad'");
// getChildren() returns a Bag, which isn't equal to the
// above ArrayList children.


// returns false, failing test
assertEquals(parent, stored);
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]