Пример #1
0
 @Test
 public void save_assignsIdToObject() {
   Task myTask = new Task("Mow the lawn", 1);
   myTask.save();
   Task savedTask = Task.all().get(0);
   assertEquals(myTask.getId(), savedTask.getId());
 }
Пример #2
0
 @Test
 public void find_findsTaskInDatabase_true() {
   Task myTask = new Task("Mow the lawn", 1);
   myTask.save();
   Task savedTask = Task.find(myTask.getId());
   assertTrue(myTask.equals(savedTask));
 }
Пример #3
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());
 }