@Test public void shouldConvertRnrKitLineItemToViaKitViewModel() { RnrFormItem rnrKitItem1 = new RnrFormItemBuilder() .setProduct(new ProductBuilder().setCode("26A01").build()) .setReceived(100) .setIssued((long) 50) .build(); RnrFormItem rnrKitItem2 = new RnrFormItemBuilder() .setProduct(new ProductBuilder().setCode("26A02").build()) .setReceived(300) .setIssued((long) 110) .build(); List<RnrFormItem> rnrFormItems = newArrayList(rnrKitItem1, rnrKitItem2); ViaKitsViewModel viaKitsViewModel = new ViaKitsViewModel(); viaKitsViewModel.convertRnrKitItemsToViaKit(rnrFormItems); assertThat(viaKitsViewModel.getKitsOpenedCHW(), is("110")); assertThat(viaKitsViewModel.getKitsOpenedHF(), is("50")); assertThat(viaKitsViewModel.getKitsReceivedCHW(), is("300")); assertThat(viaKitsViewModel.getKitsReceivedHF(), is("100")); }
public void convertRnrKitItemsToViaKit(List<RnrFormItem> rnrKitItems) { kitItems = rnrKitItems; for (RnrFormItem rnrKitItem : rnrKitItems) { if (US_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedHF = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedHF = String.valueOf(rnrKitItem.getIssued()); } } else if (APE_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedCHW = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedCHW = String.valueOf(rnrKitItem.getIssued()); } } } }
ViaKitsViewModel { public void convertRnrKitItemsToViaKit(List<RnrFormItem> rnrKitItems) { kitItems = rnrKitItems; for (RnrFormItem rnrKitItem : rnrKitItems) { if (US_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedHF = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedHF = String.valueOf(rnrKitItem.getIssued()); } } else if (APE_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedCHW = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedCHW = String.valueOf(rnrKitItem.getIssued()); } } } } }
ViaKitsViewModel { public void convertRnrKitItemsToViaKit(List<RnrFormItem> rnrKitItems) { kitItems = rnrKitItems; for (RnrFormItem rnrKitItem : rnrKitItems) { if (US_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedHF = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedHF = String.valueOf(rnrKitItem.getIssued()); } } else if (APE_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedCHW = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedCHW = String.valueOf(rnrKitItem.getIssued()); } } } }  }
ViaKitsViewModel { public void convertRnrKitItemsToViaKit(List<RnrFormItem> rnrKitItems) { kitItems = rnrKitItems; for (RnrFormItem rnrKitItem : rnrKitItems) { if (US_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedHF = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedHF = String.valueOf(rnrKitItem.getIssued()); } } else if (APE_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedCHW = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedCHW = String.valueOf(rnrKitItem.getIssued()); } } } }  void convertRnrKitItemsToViaKit(List<RnrFormItem> rnrKitItems); }
ViaKitsViewModel { public void convertRnrKitItemsToViaKit(List<RnrFormItem> rnrKitItems) { kitItems = rnrKitItems; for (RnrFormItem rnrKitItem : rnrKitItems) { if (US_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedHF = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedHF = String.valueOf(rnrKitItem.getIssued()); } } else if (APE_KIT.equals(rnrKitItem.getProduct().getCode())) { if (rnrKitItem.getReceived() > Long.MIN_VALUE) { kitsReceivedCHW = String.valueOf(rnrKitItem.getReceived()); } if (rnrKitItem.getIssued() > Long.MIN_VALUE) { kitsOpenedCHW = String.valueOf(rnrKitItem.getIssued()); } } } }  void convertRnrKitItemsToViaKit(List<RnrFormItem> rnrKitItems); static final String US_KIT; static final String APE_KIT; }