@Test public void shouldConvertViewModelToDraft() throws Exception { StockCard stockCard = new StockCard(); stockCard.setStockOnHand(10); Product product = new Product(); product.setPrimaryName("Product"); stockCard.setProduct(product); PhysicalInventoryViewModel viewModel = new PhysicalInventoryViewModel(stockCard); draftInventory = new DraftInventory(viewModel); LotMovementViewModel lotMovementViewModel1 = new LotMovementViewModel(); lotMovementViewModel1.setQuantity("10"); lotMovementViewModel1.setExpiryDate("Aug 2016"); viewModel.setNewLotMovementViewModelList(newArrayList(lotMovementViewModel1)); LotMovementViewModel lotMovementViewModel2 = new LotMovementViewModel(); lotMovementViewModel2.setQuantity("10"); lotMovementViewModel2.setExpiryDate("Aug 2016"); viewModel.setExistingLotMovementViewModelList(newArrayList(lotMovementViewModel2)); draftInventory = new DraftInventory(viewModel); assertThat(draftInventory.getQuantity(), is(20L)); assertThat(draftInventory.getDraftLotItemListWrapper().size(),is(2)); assertTrue(draftInventory.getDraftLotItemListWrapper().get(1).isNewAdded()); assertFalse(draftInventory.getDraftLotItemListWrapper().get(0).isNewAdded()); }
public List<DraftLotItem> getDraftLotItemListWrapper() { draftLotItemListWrapper = ListUtil.wrapOrEmpty(foreignDraftLotItems, draftLotItemListWrapper); return draftLotItemListWrapper; }
DraftInventory extends BaseModel { public List<DraftLotItem> getDraftLotItemListWrapper() { draftLotItemListWrapper = ListUtil.wrapOrEmpty(foreignDraftLotItems, draftLotItemListWrapper); return draftLotItemListWrapper; } }
DraftInventory extends BaseModel { public List<DraftLotItem> getDraftLotItemListWrapper() { draftLotItemListWrapper = ListUtil.wrapOrEmpty(foreignDraftLotItems, draftLotItemListWrapper); return draftLotItemListWrapper; } DraftInventory(PhysicalInventoryViewModel viewModel); }
DraftInventory extends BaseModel { public List<DraftLotItem> getDraftLotItemListWrapper() { draftLotItemListWrapper = ListUtil.wrapOrEmpty(foreignDraftLotItems, draftLotItemListWrapper); return draftLotItemListWrapper; } DraftInventory(PhysicalInventoryViewModel viewModel); List<DraftLotItem> getDraftLotItemListWrapper(); }
DraftInventory extends BaseModel { public List<DraftLotItem> getDraftLotItemListWrapper() { draftLotItemListWrapper = ListUtil.wrapOrEmpty(foreignDraftLotItems, draftLotItemListWrapper); return draftLotItemListWrapper; } DraftInventory(PhysicalInventoryViewModel viewModel); List<DraftLotItem> getDraftLotItemListWrapper();  }