Fixed issue #4259

Improved assert messages in all tests. Minor code cleanup (still much to do).

The issue was resolved by first generating near cache hits before checking them, so basically two lines were swapped (this is already fixed in master). I think this error was just masked by the former ProblematicTest category, which is now removed from this test.