vendredi 29 mai 2020

Spring test mock and object references an unsaved transient instance

In short I have an entity that have references to other entity and this entity have reference... so when I want to test the first entity I have to create many more, related entities, but I don't want to ;). Other thing I don't really want to do is to change entities/cascades just for test case. I was trying to mock "main" object by Podam (uk.co.jemos.podam.api.PodamFactory) but then I have object references an unsaved transient instance error, because related entities are not saved.

Is there any workaround for this or some other way to mock entity w/o creating referenced objects?

Using Spring with groovy tests.

Aucun commentaire:

Enregistrer un commentaire