@Test
public void testAfterPropertiesSet() throws Exception {

    try {
        factory.setRepository(null);
        factory.afterPropertiesSet();
        fail("expected exception (session factory badly initialized");
    } catch (IllegalArgumentException e) {
    }
}