Hi David & Brice,
sure, I attached shortened versions of the relevant classes.
Thanks,
Gabriel
________________________________
From:
moc...@googlegroups.com [
moc...@googlegroups.com] on behalf of David Wallace [
dmwall...@gmail.com]
Sent: Friday, August 24, 2012 10:44 AM
To:
moc...@googlegroups.com
Subject: Re: [mockito] Order cannot be returned by toString()
Hi Gabriel,
Thanks for posting.
I think you'll need to show us a little more of your code before we can really help you. Can you attach both the OrderService class and your test code to another message?
Kind regards,
David Wallace.
On Fri, Aug 24, 2012 at 8:40 PM, Gabriel <
gabriel....@trafigura.com<mailto:
gabriel....@trafigura.com>> wrote:
Hi all,
I am mocking an object using an interface (OrderService):
private OrderService mockService = mock(OrderService.class);
When I try to use when(), I get this error:
Order cannot be returned by toString()
Here is how I set it up:
when(mockService.createOrder(inputOrder)).thenReturn(outputOrder);
I don't understand how/what this error means. The Order class uses the Apache ToStringBuilder, EqualsBuilder & HashCodeBuilder. I use the relection based methods, could it be that Mockito doesn't like that? I don't see what else it could be but I have other tests that use this and other classes that use the same builder code. I don't see why it would be calling toString() on anything either. inputOrder & outputOrder are instances of the real objects btw.
I am using Mockito 1.8.5.
Thanks,
Gabriel
--
You received this message because you are subscribed to the Google Groups "mockito" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/mockito/-/Ct0icE2ycxEJ.
To post to this group, send email to
moc...@googlegroups.com<mailto:
moc...@googlegroups.com>.
To unsubscribe from this group, send email to
mockito+u...@googlegroups.com<mailto:
mockito%2Bunsu...@googlegroups.com>.
--
You received this message because you are subscribed to the Google Groups "mockito" group.
________________________________
This email and any attachments are confidential and access to this email or attachment by anyone other than the addressee is unauthorised. If you are not the intended recipient please notify the sender and delete the email including any attachments. You must not disclose or distribute any of the contents to any other person. Personal views or opinions are solely those of the author and not of Trafigura. Trafigura does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. By communicating with anyone at Trafigura by email, you consent to the monitoring or interception of such email by Trafigura in accordance with its internal policies. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted.