Alternative to use ExpectedException with AssertionError