Fixed issue #4259. Improved assert messages in all tests. Minor code cleanup (still much to do).
Merge pull request #4261 from Donnerbart/maintenance-3.x

Fixed issue #4259