@Test public void shouldThrowErrorIfInvalidDZCode() throws Exception { when(deliveryZoneService.getByCode(member.getDeliveryZone().getCode())).thenReturn(null); expectedException.expect(DataException.class); expectedException.expectMessage("deliveryZone.code.invalid"); service.save(member); }
public void save(DeliveryZoneMember member) { fillFacility(member); fillDeliveryZone(member); if (member.getId() == null) { validateIfFacilityAlreadyAssignedToDeliveryZoneForProgram(member); repository.insert(member); } else repository.update(member); }
DeliveryZoneMemberService { public void save(DeliveryZoneMember member) { fillFacility(member); fillDeliveryZone(member); if (member.getId() == null) { validateIfFacilityAlreadyAssignedToDeliveryZoneForProgram(member); repository.insert(member); } else repository.update(member); } }
DeliveryZoneMemberService { public void save(DeliveryZoneMember member) { fillFacility(member); fillDeliveryZone(member); if (member.getId() == null) { validateIfFacilityAlreadyAssignedToDeliveryZoneForProgram(member); repository.insert(member); } else repository.update(member); }  }
DeliveryZoneMemberService { public void save(DeliveryZoneMember member) { fillFacility(member); fillDeliveryZone(member); if (member.getId() == null) { validateIfFacilityAlreadyAssignedToDeliveryZoneForProgram(member); repository.insert(member); } else repository.update(member); }  void save(DeliveryZoneMember member); DeliveryZoneMember getByDeliveryZoneCodeAndFacilityCode(String deliveryZoneCode, String facilityCode); }
DeliveryZoneMemberService { public void save(DeliveryZoneMember member) { fillFacility(member); fillDeliveryZone(member); if (member.getId() == null) { validateIfFacilityAlreadyAssignedToDeliveryZoneForProgram(member); repository.insert(member); } else repository.update(member); }  void save(DeliveryZoneMember member); DeliveryZoneMember getByDeliveryZoneCodeAndFacilityCode(String deliveryZoneCode, String facilityCode);  }