Re: unit testing Cayenne objects

From: Cris Daniluk (cris.danilu..mail.com)
Date: Tue May 03 2005 - 15:14:04 EDT

  • Next message: sastan: "Re: DataContextPool"

    This might well become the infinite thread :)

    > For example, how can I test
    > my login() method without a database at all when my User object that
    > has username/password is a Cayenne object?
    > But I'd love to be taught new tricks in this realm!
    >

    If you check the list archives, you'll find some decent examples of
    mock DataContexts, etc. that people have created.

    As a generic way to solve the problem you described above, you could
    separate retrieving the User from authenticating the user, through the
    use of a Finder. Then, a MockUserFinder could substitute for database
    access.

    Of course then you'd be writing a unit test for the finder :)

    Cris



    This archive was generated by hypermail 2.0.0 : Tue May 03 2005 - 15:14:07 EDT