Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
Automatic Mocking with Spring framework Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic Mocking with Spring framework


    I am suppose to write unit testing code for my business layer by mocking DAO layer.

    I have tried to use the JMock API for this and i could inject the Mock DAO objects into the Business objects manually.

    But i thought that it is a dirty way to inject mock objects. The tough think i could face using JMock is in setting up the mock data and injecting the mock objects manually.

    As i am already using Spring framework for my application, i thought of making use of Spring for unit testing and automatically injecting DAO mock objects into BO objects while unit-testing.

    Is there a way to define mock objects, setting expectations for mock objects, maintaining test
    using spring specifically using Spring configuration files. (in a configurable way)

    Hope iam clear on my requirement. Thanks in advance for your time and attention.