@Test public void shouldSaveMappingIfMappingAlreadyExists() throws Exception { doThrow(DataIntegrityViolationException.class).when(requisitionGroupMemberMapper).insert(requisitionGroupMember); expectedEx.expect(dataExceptionMatcher("error.facility.requisition.group.mapping.exists")); repository.insert(requisitionGroupMember); verify(requisitionGroupMemberMapper, never()).insert(requisitionGroupMember); }
public void insert(RequisitionGroupMember requisitionGroupMember) { try { mapper.insert(requisitionGroupMember); } catch (DataIntegrityViolationException ex) { throw new DataException("error.facility.requisition.group.mapping.exists"); } }
RequisitionGroupMemberRepository { public void insert(RequisitionGroupMember requisitionGroupMember) { try { mapper.insert(requisitionGroupMember); } catch (DataIntegrityViolationException ex) { throw new DataException("error.facility.requisition.group.mapping.exists"); } } }
RequisitionGroupMemberRepository { public void insert(RequisitionGroupMember requisitionGroupMember) { try { mapper.insert(requisitionGroupMember); } catch (DataIntegrityViolationException ex) { throw new DataException("error.facility.requisition.group.mapping.exists"); } } @Autowired  RequisitionGroupMemberRepository(RequisitionGroupMemberMapper requisitionGroupMemberMapper); }
RequisitionGroupMemberRepository { public void insert(RequisitionGroupMember requisitionGroupMember) { try { mapper.insert(requisitionGroupMember); } catch (DataIntegrityViolationException ex) { throw new DataException("error.facility.requisition.group.mapping.exists"); } } @Autowired  RequisitionGroupMemberRepository(RequisitionGroupMemberMapper requisitionGroupMemberMapper); void insert(RequisitionGroupMember requisitionGroupMember); List<Long> getRequisitionGroupProgramIdsForFacilityId(Long facilityId); RequisitionGroupMember getRequisitionGroupMemberForRequisitionGroupIdAndFacilityId(
    RequisitionGroup requisitionGroup, Facility facility); void update(RequisitionGroupMember requisitionGroupMember); void removeRequisitionGroupMember(RequisitionGroup requisitionGroup, Facility facility); List<RequisitionGroupMember> getAllRequisitionGroupMembersByFacility(Long facilityId); void updateMembersForVirtualFacilities(Facility parentFacility); void deleteMembersFor(Facility facility); List<RequisitionGroupMember> getMembersBy(Long requisitionGroupId); void deleteMembersForGroup(Long requisitionGroupId); }
RequisitionGroupMemberRepository { public void insert(RequisitionGroupMember requisitionGroupMember) { try { mapper.insert(requisitionGroupMember); } catch (DataIntegrityViolationException ex) { throw new DataException("error.facility.requisition.group.mapping.exists"); } } @Autowired  RequisitionGroupMemberRepository(RequisitionGroupMemberMapper requisitionGroupMemberMapper); void insert(RequisitionGroupMember requisitionGroupMember); List<Long> getRequisitionGroupProgramIdsForFacilityId(Long facilityId); RequisitionGroupMember getRequisitionGroupMemberForRequisitionGroupIdAndFacilityId(
    RequisitionGroup requisitionGroup, Facility facility); void update(RequisitionGroupMember requisitionGroupMember); void removeRequisitionGroupMember(RequisitionGroup requisitionGroup, Facility facility); List<RequisitionGroupMember> getAllRequisitionGroupMembersByFacility(Long facilityId); void updateMembersForVirtualFacilities(Facility parentFacility); void deleteMembersFor(Facility facility); List<RequisitionGroupMember> getMembersBy(Long requisitionGroupId); void deleteMembersForGroup(Long requisitionGroupId);  }