@Test(expected = IllegalArgumentException.class) public void handlesRuntimeExceptionsCorrectly() { SampleRepository repository = factory.getRepository(SampleRepository.class, new SampleCustomRepositoryImpl()); repository.throwingRuntimeException(); }