I have a test in Ruby as follows
def testSomeObjectsAreEqual
assert_equal( object1, object2 )
end
When this test fails I get an error message which states that the two objects are not equal and gives the following style of message for the expected and actual values:
<#<Java:com.mynamespace.MyClass:0x1232b3e12>> expected but was
<#<Java:com.mynamespace.MyClass:0x489654ebd>>.
As you can see I am using JRuby to instantiate a Java class and that is the object being compared. I've trying printing object.to_s in Ruby and that prints a sensible looking message, it seems to map directly to the Java declared toString() method for MyClass, however to_s does not seem to be used for the failure message of the assertion. Is there anyway I can get Ruby test/unit to use the to_s value of the objects as this would make the failure messages much more useful for me?