hintManager.saveHint(hint);
hintDao.verify();
}
public void testAddAndRemoveHint() throws Exception {
Hint hint = new Hint();
// set required fields
// set expected behavior on dao
hintDao.expects(once()).method("saveHint")
.with(same(hint)).isVoid();
hintManager.saveHint(hint);
hintDao.verify();
// reset expectations
hintDao.reset();
hintDao.expects(once()).method("removeHint").with(eq(new Long(hintId)));
hintManager.removeHint(hintId);
hintDao.verify();
// reset expectations
hintDao.reset();
// remove
Exception ex = new ObjectRetrievalFailureException(Hint.class, hint.getHintId());
hintDao.expects(once()).method("removeHint").isVoid();
hintDao.expects(once()).method("getHint").will(throwException(ex));
hintManager.removeHint(hintId);
try {
hintManager.getHint(hintId);