Hi forum,
I have a domain model which falls into several areas. One is dealing with a catalog (categories + product), one deals with items and another one with a third area of responsability.
I am currently following the idea to abstract the hibernate persistence implementation using some kind of a persistence manager (interface). Also there are several sub domain objects each managing its own area of responsibility. Therefore the catalog is accessed and modified using some kind of a catalog store and the items are managed by an item store etc.
Since the persistence manager is abstracted within the catalog store I have to test it on isolation. Therefore I mock the persistence manager and test if the appropriated interaction between the catalog store and the persistence manager takes places. Works fine and is fast. But the problem is testing the hibernate persistence manager. Since it is abstracted I have to test all domain objects against the hibernate persistence manager. Therefore the hibernate persistence manager TestCase class contains many, many test methods. Like adding and retrieve a product, adding and retrieve a category, adding and retrieve an item, add a product to a category, remove a category and check if the product is also removed and so on. I think you guess the meaning.
Since the TestCase gots so polluted I want to refactor it, to seperate the testing and maybe alter the design.
Does anyone have a suitable way to alter the design? How's your favorite design?
Thanks,
Martin (Kersten)
|