@Test public void shouldInsertBudgetLineItemIfDoesNotExistsAlready() throws Exception { BudgetLineItem budgetLineItem = new BudgetLineItem(1L, 2L, 1L, 1L, new Date(), BigDecimal.valueOf(345.45), "My good notes"); repository.save(budgetLineItem); verify(mapper).insert(budgetLineItem); }
public void save(BudgetLineItem budgetLineItem) { try { mapper.insert(budgetLineItem); } catch (DuplicateKeyException e) { mapper.update(budgetLineItem); } }
BudgetLineItemRepository { public void save(BudgetLineItem budgetLineItem) { try { mapper.insert(budgetLineItem); } catch (DuplicateKeyException e) { mapper.update(budgetLineItem); } } }
BudgetLineItemRepository { public void save(BudgetLineItem budgetLineItem) { try { mapper.insert(budgetLineItem); } catch (DuplicateKeyException e) { mapper.update(budgetLineItem); } }  }
BudgetLineItemRepository { public void save(BudgetLineItem budgetLineItem) { try { mapper.insert(budgetLineItem); } catch (DuplicateKeyException e) { mapper.update(budgetLineItem); } }  void save(BudgetLineItem budgetLineItem); BudgetLineItem get(Long facilityId, Long programId, Long periodId); }
BudgetLineItemRepository { public void save(BudgetLineItem budgetLineItem) { try { mapper.insert(budgetLineItem); } catch (DuplicateKeyException e) { mapper.update(budgetLineItem); } }  void save(BudgetLineItem budgetLineItem); BudgetLineItem get(Long facilityId, Long programId, Long periodId);  }