VID-1953 Make the unit tests fail with a better message

Also fix a warning about matching function prototypes
Minor: else is not necessary because `->fail()` terminates the code by throwing an exception.