@Test(expected = IllegalArgumentException.class) public void handlesRuntimeExceptionsCorrectly() { SampleDao dao = factory.getDao(SampleDao.class, new SampleCustomDaoImpl()); dao.throwingRuntimeException(); }