Пример #1
0
 @Test
 public void save_savesCategoryIdIntoDB_true() {
   Category myCategory = new Category("Household chores");
   myCategory.save();
   Task myTask = new Task("Mow the lawn", myCategory.getId());
   myTask.save();
   Task savedTask = Task.find(myTask.getId());
   assertEquals(savedTask.getCategoryId(), myCategory.getId());
 }
Пример #2
0
 // 事务声明
 @Transactional
 @RequestMapping(params = "method=save")
 public ModelAndView save(HttpServletRequest request) {
   Category category = new Category(RequestUtil.getMap(request));
   return new ModelAndView("jsonView", category.save());
 }