コード例 #1
0
 public void testSavingEqualExpenses() throws Exception {
   repository.save(expense);
   assertEquals(repository.size(), 1);
   try {
     expense.setExpenseID(expense.getExpenseID() + 1);
     repository.save(expense);
   } catch (MyException e) {
     assertEquals(repository.size(), 1);
   }
 }
コード例 #2
0
 public void testInvalidSave() throws Exception {
   try {
     repository.save(invalidExpense);
   } catch (MyException e) {
     assertEquals(repository.size(), 0);
   }
 }
コード例 #3
0
 protected void saveEntities() {
   for (Expense e : entities) {
     try {
       repository.save(e);
     } catch (MyException ex) {
       System.out.println(ex.getMessage());
     } catch (Exception e1) {
       e1.printStackTrace();
     }
   }
 }
コード例 #4
0
 public void testSize() throws Exception {
   assertEquals(repository.size(), 0);
   repository.save(expense);
   assertEquals(repository.size(), 1);
 }
コード例 #5
0
 public void testFindByID() throws Exception {
   repository.save(expense);
   assertEquals(repositoryUtils.getEntityID(expense), 1);
 }