Hello!
If i have a MockEndpoint which gets an POJO object in Message Body it try to
compare it with expected result using:
camel/util/ObjectHelper.java
ObjectHelper.equal(method)

Which contains following lines:
/**
     * A helper method for comparing objects for equality while handling
nulls
     */
    public static boolean equal(Object a, Object b) {
        if (a == b) {
            return true;
        }

        if (a instanceof byte[] && b instanceof byte[]) {
            return equalByteArray((byte[])a, (byte[])b);
        }

        return a != null && b != null && a.equals(b);
    }

This is sort of very strange method to compare Objects. It will work for
Strings and primitives, but won't work for POJO, because it compare with
"==" operator, and do not compare with .equals(obj1) method.
So i put
resultEndpoint.expectedBodiesReceived(expectedMT);
where expectedMT is instance of MT class
and then tested method will send to mocked Endpoint new instance of MT, with
the same data.
But
resultEndpoint.assertIsSatisfied();
will give error, because are not the same. like:
Expected: <com.somepackage.MT@2674f9fb> but was:
<com.somepackage.MT@53ddcd5f>

If assertIsSatisfied would work correctly and would use equals instead of
"==" then there would be correct assertion. 

Is it a bug, or i missuse MockEndpoint somehow?



--
View this message in context: 
http://camel.465427.n5.nabble.com/MockEndpoint-assertIsSatisfied-Object-Object-tp5716388.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to