authentificationElementManager.saveAuthentificationElement(authentificationElement);
authentificationElementDao.verify();
}
public void testAddAndRemoveAuthentificationElement() throws Exception {
AuthentificationElement authentificationElement = new AuthentificationElement();
// set required fields
// set expected behavior on dao
authentificationElementDao.expects(once()).method("saveAuthentificationElement")
.with(same(authentificationElement)).isVoid();
authentificationElementManager.saveAuthentificationElement(authentificationElement);
authentificationElementDao.verify();
// reset expectations
authentificationElementDao.reset();
authentificationElementDao.expects(once()).method("removeAuthentificationElement").with(eq(new Long(authentificationElementId)));
authentificationElementManager.removeAuthentificationElement(authentificationElementId);
authentificationElementDao.verify();
// reset expectations
authentificationElementDao.reset();
// remove
Exception ex = new ObjectRetrievalFailureException(AuthentificationElement.class, authentificationElement.getAuthentificationId());
authentificationElementDao.expects(once()).method("removeAuthentificationElement").isVoid();
authentificationElementDao.expects(once()).method("getAuthentificationElement").will(throwException(ex));
authentificationElementManager.removeAuthentificationElement(authentificationElementId);
try {
authentificationElementManager.getAuthentificationElement(authentificationElementId);