questionTypeManager.saveQuestionType(questionType);
questionTypeDao.verify();
}
public void testAddAndRemoveQuestionType() throws Exception {
QuestionType questionType = new QuestionType();
// set required fields
// set expected behavior on dao
questionTypeDao.expects(once()).method("saveQuestionType")
.with(same(questionType)).isVoid();
questionTypeManager.saveQuestionType(questionType);
questionTypeDao.verify();
// reset expectations
questionTypeDao.reset();
questionTypeDao.expects(once()).method("removeQuestionType").with(eq(new Long(questionTypeId)));
questionTypeManager.removeQuestionType(questionTypeId);
questionTypeDao.verify();
// reset expectations
questionTypeDao.reset();
// remove
Exception ex = new ObjectRetrievalFailureException(QuestionType.class, questionType.getQuestionTypeId());
questionTypeDao.expects(once()).method("removeQuestionType").isVoid();
questionTypeDao.expects(once()).method("getQuestionType").will(throwException(ex));
questionTypeManager.removeQuestionType(questionTypeId);
try {
questionTypeManager.getQuestionType(questionTypeId);