Add test for saveAssociated and expression objects.

Add a test for #1514. This issue was fixed during recent refactorings.

Closes #1514