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 testInvalidSave() throws Exception { try { repository.save(invalidExpense); } catch (MyException e) { assertEquals(repository.size(), 0); } }
public void testDeleteInexistentExpense() throws MyException { assertEquals(repository.size(), 0); try { repository.delete(expense); throw new MyException("Delete test failed"); } catch (MyException e) { } }
public void testDeleteExpense() throws MyException { saveEntities(); assertEquals(repository.size(), entities.size()); repository.delete(entities.get(2)); assertEquals(repository.size(), entities.size() - 1); }
public void testSize() throws Exception { assertEquals(repository.size(), 0); repository.save(expense); assertEquals(repository.size(), 1); }
public void testFindAll() throws Exception { saveEntities(); assertEquals(repository.size(), entities.size()); }