Test fails on exception not thrown