New assertEquals() for Beans

"[email protected] [junit]" <[email protected]> 14 May 2014 09:52:44 -0700
Newsgroups gmane.comp.java.junit.user
Message-ID <[email protected]>
Hi JUnit-Folks! 
 

 We would like to contribute to JUnit by adding a new assertEquals()-method that compares classes that satisfy the JavaBeans specification. The method could create a detailed errormessage to show which properties of the compared beans don't match if the comparison fails. 
 

 The idea was born, since we have offen faced a situation where we compared two Beans with several properties using the assertEquals(Object, Object)-method. If that assert fails you don't know which properties of the compared Beans don't match and cause the assert to fail. 
 Currently you often end up with tedious extra work to find out which property is wrong, like 
 writing assertEquals() for every single property, 
 debugging the testcase, 
 or writing a toString()-method that prints out the property-values, so that the values are visible in the fail-message and can be compared manually.
 
 

 Since we believe that this situation is quite common and independent from special architectures, libraries or projects we would appreciate a junit-internal solution. 
 

 What do you think about adding such an assertEqualsBean()-method to Assert? We would be glad to create a pull-request if you like the idea! 
 

 
 Greetings
 Maurice-Marie Stromer,
 
 Jan Schankin