@Test public void testUnbindWithException() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; try { // Perform test dummyDao.unbindWithException(dn, "Some Person"); fail("DummyException expected"); } catch (DummyException expected) { assertTrue(true); } // Verify result - check that the operation was properly rolled back Object ldapResult = ldapTemplate.lookup( dn, new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) throws NamingException { // Just verify that the entry still exists. return new Object(); } }); assertNotNull(ldapResult); }