Details
Description
As documented we should be able to check the list size of testInstances after doing a save():
List testInstances = []
mockDomain(MyType, testInstances)
def instance = new MyType()
instance.save()
assertEquals (1, testInstances.size())
Unfortunately the assertion fails because there will be a replacement list created in MockUtils.mockDomain(...). So the saved instances are not added to the given List.
The workaround I use is:
List testInstances = []
mockDomain(MyType, testInstances)
def instance = new MyType()
instance.save()
def checkInstances = MockUtils.TEST_INSTANCES[(MyType)]
assertEquals (1, checkInstances.size())
At least this is a documentation Bug.
Issue Links
| This issue duplicates: | ||||
| GRAILS-5739 | mockDomain(Class domainClass, List instances = []) doesn't store the saved domain object in instances |
|
|
|
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits