@Test public void shouldGenerateOrderNumberAccordingToConfiguration() { OrderNumberConfiguration orderNumberConfiguration = new OrderNumberConfiguration("Ord", true, true, true, true); Program program = new Program(1L); program.setCode("MALARIA"); String orderNumber = orderNumberConfiguration.getOrderNumberFor(1L, program, false); assertThat(orderNumber, is("OrdMALARIA00000001R")); orderNumberConfiguration = new OrderNumberConfiguration("Ord", true, false, true, true); orderNumber = orderNumberConfiguration.getOrderNumberFor(1L, program, false); assertThat(orderNumber, is("Ord00000001R")); }
public String getOrderNumberFor(Long orderId, Program program, Boolean emergeny) { StringBuilder orderNumber = new StringBuilder(); if (includeOrderNumberPrefix && orderNumberPrefix != null) orderNumber.append(getOrderNumberPrefix()); if (includeProgramCode) orderNumber.append(getTruncatedProgramCode(program.getCode())); orderNumber.append(getSequenceAppendedOrderId(orderId)); if (includeRnrTypeSuffix) orderNumber.append(emergeny ? "E" : "R"); return orderNumber.toString(); }
OrderNumberConfiguration { public String getOrderNumberFor(Long orderId, Program program, Boolean emergeny) { StringBuilder orderNumber = new StringBuilder(); if (includeOrderNumberPrefix && orderNumberPrefix != null) orderNumber.append(getOrderNumberPrefix()); if (includeProgramCode) orderNumber.append(getTruncatedProgramCode(program.getCode())); orderNumber.append(getSequenceAppendedOrderId(orderId)); if (includeRnrTypeSuffix) orderNumber.append(emergeny ? "E" : "R"); return orderNumber.toString(); } }
OrderNumberConfiguration { public String getOrderNumberFor(Long orderId, Program program, Boolean emergeny) { StringBuilder orderNumber = new StringBuilder(); if (includeOrderNumberPrefix && orderNumberPrefix != null) orderNumber.append(getOrderNumberPrefix()); if (includeProgramCode) orderNumber.append(getTruncatedProgramCode(program.getCode())); orderNumber.append(getSequenceAppendedOrderId(orderId)); if (includeRnrTypeSuffix) orderNumber.append(emergeny ? "E" : "R"); return orderNumber.toString(); }  }
OrderNumberConfiguration { public String getOrderNumberFor(Long orderId, Program program, Boolean emergeny) { StringBuilder orderNumber = new StringBuilder(); if (includeOrderNumberPrefix && orderNumberPrefix != null) orderNumber.append(getOrderNumberPrefix()); if (includeProgramCode) orderNumber.append(getTruncatedProgramCode(program.getCode())); orderNumber.append(getSequenceAppendedOrderId(orderId)); if (includeRnrTypeSuffix) orderNumber.append(emergeny ? "E" : "R"); return orderNumber.toString(); }  void validate(); String getOrderNumberFor(Long orderId, Program program, Boolean emergeny); }
OrderNumberConfiguration { public String getOrderNumberFor(Long orderId, Program program, Boolean emergeny) { StringBuilder orderNumber = new StringBuilder(); if (includeOrderNumberPrefix && orderNumberPrefix != null) orderNumber.append(getOrderNumberPrefix()); if (includeProgramCode) orderNumber.append(getTruncatedProgramCode(program.getCode())); orderNumber.append(getSequenceAppendedOrderId(orderId)); if (includeRnrTypeSuffix) orderNumber.append(emergeny ? "E" : "R"); return orderNumber.toString(); }  void validate(); String getOrderNumberFor(Long orderId, Program program, Boolean emergeny);  }