constructionTypeManager.saveConstructionType(constructionType);
constructionTypeDao.verify();
}
public void testAddAndRemoveConstructionType() throws Exception {
ConstructionType constructionType = new ConstructionType();
// set required fields
// set expected behavior on dao
constructionTypeDao.expects(once()).method("saveConstructionType")
.with(same(constructionType)).isVoid();
constructionTypeManager.saveConstructionType(constructionType);
constructionTypeDao.verify();
// reset expectations
constructionTypeDao.reset();
constructionTypeDao.expects(once()).method("removeConstructionType").with(eq(new Long(constructionTypeId)));
constructionTypeManager.removeConstructionType(constructionTypeId);
constructionTypeDao.verify();
// reset expectations
constructionTypeDao.reset();
// remove
Exception ex = new ObjectRetrievalFailureException(ConstructionType.class, constructionType.getConstructionTypeId());
constructionTypeDao.expects(once()).method("removeConstructionType").isVoid();
constructionTypeDao.expects(once()).method("getConstructionType").will(throwException(ex));
constructionTypeManager.removeConstructionType(constructionTypeId);
try {
constructionTypeManager.getConstructionType(constructionTypeId);