defectRecomendationManager.saveDefectRecomendation(defectRecomendation);
defectRecomendationDao.verify();
}
public void testAddAndRemoveDefectRecomendation() throws Exception {
DefectRecomendation defectRecomendation = new DefectRecomendation();
// set required fields
// set expected behavior on dao
defectRecomendationDao.expects(once()).method("saveDefectRecomendation")
.with(same(defectRecomendation)).isVoid();
defectRecomendationManager.saveDefectRecomendation(defectRecomendation);
defectRecomendationDao.verify();
// reset expectations
defectRecomendationDao.reset();
defectRecomendationDao.expects(once()).method("removeDefectRecomendation").with(eq(new Long(defectRecomendationId)));
defectRecomendationManager.removeDefectRecomendation(defectRecomendationId);
defectRecomendationDao.verify();
// reset expectations
defectRecomendationDao.reset();
// remove
Exception ex = new ObjectRetrievalFailureException(DefectRecomendation.class, defectRecomendation.getDefectRecomendationId());
defectRecomendationDao.expects(once()).method("removeDefectRecomendation").isVoid();
defectRecomendationDao.expects(once()).method("getDefectRecomendation").will(throwException(ex));
defectRecomendationManager.removeDefectRecomendation(defectRecomendationId);
try {
defectRecomendationManager.getDefectRecomendation(defectRecomendationId);