@Test public void shouldThrowExceptionForDuplicateSupplyLinesWhileUpdate() { doThrow(new DataException("Duplicate entry for Supply Line found")).when(mapper).update(supplyLine); expectedEx.expect(DataException.class); expectedEx.expectMessage("Duplicate entry for Supply Line found"); repository.update(supplyLine); }
public void update(SupplyLine supplyLine) { try { mapper.update(supplyLine); } catch (DuplicateKeyException ex) { throw new DataException("error.supplying.facility.already.assigned"); } }
SupplyLineRepository { public void update(SupplyLine supplyLine) { try { mapper.update(supplyLine); } catch (DuplicateKeyException ex) { throw new DataException("error.supplying.facility.already.assigned"); } } }
SupplyLineRepository { public void update(SupplyLine supplyLine) { try { mapper.update(supplyLine); } catch (DuplicateKeyException ex) { throw new DataException("error.supplying.facility.already.assigned"); } }  }
SupplyLineRepository { public void update(SupplyLine supplyLine) { try { mapper.update(supplyLine); } catch (DuplicateKeyException ex) { throw new DataException("error.supplying.facility.already.assigned"); } }  void insert(SupplyLine supplyLine); SupplyLine getSupplyLineBy(SupervisoryNode supervisoryNode, Program program); void update(SupplyLine supplyLine); SupplyLine getById(Long id); List<SupplyLine> search(String searchParam, String column, Pagination pagination); Integer getTotalSearchResultCount(String searchParam, String column); List<Facility> getSupplyingFacilities(Long userId); SupplyLine getSupplyLineByFacilityProgram(Long facilityId, Long programId); }
SupplyLineRepository { public void update(SupplyLine supplyLine) { try { mapper.update(supplyLine); } catch (DuplicateKeyException ex) { throw new DataException("error.supplying.facility.already.assigned"); } }  void insert(SupplyLine supplyLine); SupplyLine getSupplyLineBy(SupervisoryNode supervisoryNode, Program program); void update(SupplyLine supplyLine); SupplyLine getById(Long id); List<SupplyLine> search(String searchParam, String column, Pagination pagination); Integer getTotalSearchResultCount(String searchParam, String column); List<Facility> getSupplyingFacilities(Long userId); SupplyLine getSupplyLineByFacilityProgram(Long facilityId, Long programId);  }