@Test public void shouldThrowErrorIfInvalidFacilityCode() throws Exception { when(facilityService.getByCode(deliveryZoneWarehouse.getWarehouse())).thenReturn(null); expectedException.expect(DataException.class); expectedException.expectMessage("warehouse.code.invalid"); service.save(deliveryZoneWarehouse); }
public void save(DeliveryZoneWarehouse deliveryZoneWarehouse) { fillFacility(deliveryZoneWarehouse); fillDeliveryZone(deliveryZoneWarehouse); if (deliveryZoneWarehouse.getId() == null) repository.insert(deliveryZoneWarehouse); else repository.update(deliveryZoneWarehouse); }
DeliveryZoneWarehouseService { public void save(DeliveryZoneWarehouse deliveryZoneWarehouse) { fillFacility(deliveryZoneWarehouse); fillDeliveryZone(deliveryZoneWarehouse); if (deliveryZoneWarehouse.getId() == null) repository.insert(deliveryZoneWarehouse); else repository.update(deliveryZoneWarehouse); } }
DeliveryZoneWarehouseService { public void save(DeliveryZoneWarehouse deliveryZoneWarehouse) { fillFacility(deliveryZoneWarehouse); fillDeliveryZone(deliveryZoneWarehouse); if (deliveryZoneWarehouse.getId() == null) repository.insert(deliveryZoneWarehouse); else repository.update(deliveryZoneWarehouse); }  }
DeliveryZoneWarehouseService { public void save(DeliveryZoneWarehouse deliveryZoneWarehouse) { fillFacility(deliveryZoneWarehouse); fillDeliveryZone(deliveryZoneWarehouse); if (deliveryZoneWarehouse.getId() == null) repository.insert(deliveryZoneWarehouse); else repository.update(deliveryZoneWarehouse); }  void save(DeliveryZoneWarehouse deliveryZoneWarehouse); DeliveryZoneWarehouse getByDeliveryZoneCodeAndWarehouseCode(String deliveryZoneCode, String warehouseCode); }
DeliveryZoneWarehouseService { public void save(DeliveryZoneWarehouse deliveryZoneWarehouse) { fillFacility(deliveryZoneWarehouse); fillDeliveryZone(deliveryZoneWarehouse); if (deliveryZoneWarehouse.getId() == null) repository.insert(deliveryZoneWarehouse); else repository.update(deliveryZoneWarehouse); }  void save(DeliveryZoneWarehouse deliveryZoneWarehouse); DeliveryZoneWarehouse getByDeliveryZoneCodeAndWarehouseCode(String deliveryZoneCode, String warehouseCode);  }