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); } }
public void testFindByUser() { saveEntities(); User u = entities.get(1).getUser(); ArrayList<Expense> expenses; expenses = repositoryUtils.findByUser(u); assertNotNull(expenses); expenses = repositoryUtils.findByUser(expense.getUser()); assertNull(expenses); }