Java Mailing List Archive

http://www.gg3721.com/

Home » user.jmock »

[jmock-user] Re: How to test a method that is wrapped in a private method?

sparks

2008-07-02

Replies: Find Java Web Hosting

Author LoginPost Reply
Nat Pryce <nat.pryce@(protected):
>
> It could be that the dao is not being set by the setter. Instead of a
> setter, use a constructor parameter and make the dao field final, so
> that the setter can never get hold of the wrong DAO and it cannot
> change after construction.
>
> It could be that the data being passed to the DAO does not have an
> equals method defined for it, so two different objects that represent
> the same value compare as being different. If the data being passed
> to the DAO is just a value, then it should be made immutable and given
> an equals method. If it is mutable -- changes over time -- then it
> should not be given an equals method. Instead you could write a
> Matcher to check that the data passed to the DAO has the expected
> state (see the website).

Thanks for your help Nat!

The parameter I passed to the test method made the logic flow to another branch
which doesn't call the DAO method at all.

Really appreciate the fast and helpful responses!




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.