I know this post doesnt have much to do with the Spring framework but wanted to get some feedback from fellow developers as this must be a common problem.
Furthermore I using Spring for integration testing purposes where Im testing business methods expose by a service layer. More so the problem I have is that part of the integration testing is to create/mock domain models/objects used by the services ie.:
Two problems im facing:
1. If I use EasyMock as above ALL my domain models that I want to mock have to be interfaces of which currently no domain models are as to me this is an extreme case of too many interfaces especially as all my models are hibernate specific. Find below an outline of the Client model:
2. Im trying to replicate an invocation to the "getPrimaryId()" method of which is causing an issue when I mock the Client.class using either Mockito and EasyMock as the getPrimaryId() method is used in the "equals()" method in the domain model. This is causing a StackOverflow as both mocking frameworks use the equals method to determine which mock object to evaluation and test against. The equals method is as follow: