Use ExpectedException in tests