@Test public void shouldSetOrderStatusFlagTrueIfOrderIsReceived() throws Exception { Rnr rnr = make(a(RequisitionBuilder.defaultRequisition, with(id, 2L), with(program, make(a(defaultProgram, with(ProgramBuilder.programName, "HIV")))))); Order order = new Order(rnr); order.setSupplyLine(make(a(defaultSupplyLine, with(SupplyLineBuilder.facility, make(a(FacilityBuilder.defaultFacility, with(name, "F10"))))))); order.setStatus(OrderStatus.IN_ROUTE); assertFalse(OrderPODDTO.getOrderDetailsForPOD(order).getAlreadyReceived()); order.setStatus(OrderStatus.RECEIVED); assertTrue(OrderPODDTO.getOrderDetailsForPOD(order).getAlreadyReceived()); }
public static OrderPODDTO getOrderDetailsForPOD(Order order) throws ParseException { OrderPODDTO orderPODDTO = new OrderPODDTO(); orderPODDTO.setId(order.getId()); orderPODDTO.setOrderNumber(order.getOrderNumber()); String createdDate = order.getCreatedDate() == null ? null : new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(order.getCreatedDate()); orderPODDTO.setStringCreatedDate(createdDate); orderPODDTO.setSupplyingDepot(order.getSupplyLine().getSupplyingFacility().getName()); orderPODDTO.setFacilityCode(order.getRnr().getFacility().getCode()); orderPODDTO.setFacilityName(order.getRnr().getFacility().getName()); orderPODDTO.setProgramName(order.getRnr().getProgram().getName()); orderPODDTO.setDistrict(order.getRnr().getFacility().getGeographicZone().getName()); orderPODDTO.setRegion(order.getRnr().getFacility().getGeographicZone().getParent().getName()); orderPODDTO.setPeriodStartDate(order.getRnr().getPeriod().getStringStartDate()); orderPODDTO.setPeriodEndDate(order.getRnr().getPeriod().getStringEndDate()); orderPODDTO.setEmergency(order.getRnr().isEmergency()); orderPODDTO.setAlreadyReceived(order.getStatus() == OrderStatus.RECEIVED); return orderPODDTO; }
OrderPODDTO { public static OrderPODDTO getOrderDetailsForPOD(Order order) throws ParseException { OrderPODDTO orderPODDTO = new OrderPODDTO(); orderPODDTO.setId(order.getId()); orderPODDTO.setOrderNumber(order.getOrderNumber()); String createdDate = order.getCreatedDate() == null ? null : new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(order.getCreatedDate()); orderPODDTO.setStringCreatedDate(createdDate); orderPODDTO.setSupplyingDepot(order.getSupplyLine().getSupplyingFacility().getName()); orderPODDTO.setFacilityCode(order.getRnr().getFacility().getCode()); orderPODDTO.setFacilityName(order.getRnr().getFacility().getName()); orderPODDTO.setProgramName(order.getRnr().getProgram().getName()); orderPODDTO.setDistrict(order.getRnr().getFacility().getGeographicZone().getName()); orderPODDTO.setRegion(order.getRnr().getFacility().getGeographicZone().getParent().getName()); orderPODDTO.setPeriodStartDate(order.getRnr().getPeriod().getStringStartDate()); orderPODDTO.setPeriodEndDate(order.getRnr().getPeriod().getStringEndDate()); orderPODDTO.setEmergency(order.getRnr().isEmergency()); orderPODDTO.setAlreadyReceived(order.getStatus() == OrderStatus.RECEIVED); return orderPODDTO; } }
OrderPODDTO { public static OrderPODDTO getOrderDetailsForPOD(Order order) throws ParseException { OrderPODDTO orderPODDTO = new OrderPODDTO(); orderPODDTO.setId(order.getId()); orderPODDTO.setOrderNumber(order.getOrderNumber()); String createdDate = order.getCreatedDate() == null ? null : new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(order.getCreatedDate()); orderPODDTO.setStringCreatedDate(createdDate); orderPODDTO.setSupplyingDepot(order.getSupplyLine().getSupplyingFacility().getName()); orderPODDTO.setFacilityCode(order.getRnr().getFacility().getCode()); orderPODDTO.setFacilityName(order.getRnr().getFacility().getName()); orderPODDTO.setProgramName(order.getRnr().getProgram().getName()); orderPODDTO.setDistrict(order.getRnr().getFacility().getGeographicZone().getName()); orderPODDTO.setRegion(order.getRnr().getFacility().getGeographicZone().getParent().getName()); orderPODDTO.setPeriodStartDate(order.getRnr().getPeriod().getStringStartDate()); orderPODDTO.setPeriodEndDate(order.getRnr().getPeriod().getStringEndDate()); orderPODDTO.setEmergency(order.getRnr().isEmergency()); orderPODDTO.setAlreadyReceived(order.getStatus() == OrderStatus.RECEIVED); return orderPODDTO; }  }
OrderPODDTO { public static OrderPODDTO getOrderDetailsForPOD(Order order) throws ParseException { OrderPODDTO orderPODDTO = new OrderPODDTO(); orderPODDTO.setId(order.getId()); orderPODDTO.setOrderNumber(order.getOrderNumber()); String createdDate = order.getCreatedDate() == null ? null : new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(order.getCreatedDate()); orderPODDTO.setStringCreatedDate(createdDate); orderPODDTO.setSupplyingDepot(order.getSupplyLine().getSupplyingFacility().getName()); orderPODDTO.setFacilityCode(order.getRnr().getFacility().getCode()); orderPODDTO.setFacilityName(order.getRnr().getFacility().getName()); orderPODDTO.setProgramName(order.getRnr().getProgram().getName()); orderPODDTO.setDistrict(order.getRnr().getFacility().getGeographicZone().getName()); orderPODDTO.setRegion(order.getRnr().getFacility().getGeographicZone().getParent().getName()); orderPODDTO.setPeriodStartDate(order.getRnr().getPeriod().getStringStartDate()); orderPODDTO.setPeriodEndDate(order.getRnr().getPeriod().getStringEndDate()); orderPODDTO.setEmergency(order.getRnr().isEmergency()); orderPODDTO.setAlreadyReceived(order.getStatus() == OrderStatus.RECEIVED); return orderPODDTO; }  static OrderPODDTO getOrderDetailsForPOD(Order order); }
OrderPODDTO { public static OrderPODDTO getOrderDetailsForPOD(Order order) throws ParseException { OrderPODDTO orderPODDTO = new OrderPODDTO(); orderPODDTO.setId(order.getId()); orderPODDTO.setOrderNumber(order.getOrderNumber()); String createdDate = order.getCreatedDate() == null ? null : new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(order.getCreatedDate()); orderPODDTO.setStringCreatedDate(createdDate); orderPODDTO.setSupplyingDepot(order.getSupplyLine().getSupplyingFacility().getName()); orderPODDTO.setFacilityCode(order.getRnr().getFacility().getCode()); orderPODDTO.setFacilityName(order.getRnr().getFacility().getName()); orderPODDTO.setProgramName(order.getRnr().getProgram().getName()); orderPODDTO.setDistrict(order.getRnr().getFacility().getGeographicZone().getName()); orderPODDTO.setRegion(order.getRnr().getFacility().getGeographicZone().getParent().getName()); orderPODDTO.setPeriodStartDate(order.getRnr().getPeriod().getStringStartDate()); orderPODDTO.setPeriodEndDate(order.getRnr().getPeriod().getStringEndDate()); orderPODDTO.setEmergency(order.getRnr().isEmergency()); orderPODDTO.setAlreadyReceived(order.getStatus() == OrderStatus.RECEIVED); return orderPODDTO; }  static OrderPODDTO getOrderDetailsForPOD(Order order);  }