@Test public void shouldSetInitialAmountCorrectWhenTypeIsPhysical() throws Exception { stockMovementItem.setMovementType(MovementReasonManager.MovementType.PHYSICAL_INVENTORY); stockMovementItem.setMovementQuantity(0L); long calculatePreviousSOH = stockMovementItem.calculatePreviousSOH(); assertThat(calculatePreviousSOH, is(100L)); }
public long calculatePreviousSOH() { if (isNegativeMovement()) { return stockOnHand + movementQuantity; } else if (isPositiveMovement()) { return stockOnHand - movementQuantity; } else { return stockOnHand; } }
StockMovementItem extends BaseModel { public long calculatePreviousSOH() { if (isNegativeMovement()) { return stockOnHand + movementQuantity; } else if (isPositiveMovement()) { return stockOnHand - movementQuantity; } else { return stockOnHand; } } }
StockMovementItem extends BaseModel { public long calculatePreviousSOH() { if (isNegativeMovement()) { return stockOnHand + movementQuantity; } else if (isPositiveMovement()) { return stockOnHand - movementQuantity; } else { return stockOnHand; } } StockMovementItem(StockCard stockCard, InventoryViewModel model);  StockMovementItem(StockCard stockCard, InventoryViewModel model, boolean fromInitialInventory);  StockMovementItem(StockCard stockCard); }
StockMovementItem extends BaseModel { public long calculatePreviousSOH() { if (isNegativeMovement()) { return stockOnHand + movementQuantity; } else if (isPositiveMovement()) { return stockOnHand - movementQuantity; } else { return stockOnHand; } } StockMovementItem(StockCard stockCard, InventoryViewModel model);  StockMovementItem(StockCard stockCard, InventoryViewModel model, boolean fromInitialInventory);  StockMovementItem(StockCard stockCard); boolean isPositiveMovement(); boolean isNegativeMovement(); Period getMovementPeriod(); long calculatePreviousSOH(); List<LotMovementItem> getLotMovementItemListWrapper(); List<LotMovementItem> getNewAddedLotMovementItemListWrapper(); void populateLotQuantitiesAndCalculateNewSOH(List<LotMovementViewModel> lotMovementViewModelList,
                                                        MovementReasonManager.MovementType movementType); void populateLotAndResetStockOnHandOfLotAccordingPhysicalAdjustment(List<LotMovementViewModel> existingLotMovementList,
                                                                               List<LotMovementViewModel> newAddedLotMovementList); @Override String toString(); }
StockMovementItem extends BaseModel { public long calculatePreviousSOH() { if (isNegativeMovement()) { return stockOnHand + movementQuantity; } else if (isPositiveMovement()) { return stockOnHand - movementQuantity; } else { return stockOnHand; } } StockMovementItem(StockCard stockCard, InventoryViewModel model);  StockMovementItem(StockCard stockCard, InventoryViewModel model, boolean fromInitialInventory);  StockMovementItem(StockCard stockCard); boolean isPositiveMovement(); boolean isNegativeMovement(); Period getMovementPeriod(); long calculatePreviousSOH(); List<LotMovementItem> getLotMovementItemListWrapper(); List<LotMovementItem> getNewAddedLotMovementItemListWrapper(); void populateLotQuantitiesAndCalculateNewSOH(List<LotMovementViewModel> lotMovementViewModelList,
                                                        MovementReasonManager.MovementType movementType); void populateLotAndResetStockOnHandOfLotAccordingPhysicalAdjustment(List<LotMovementViewModel> existingLotMovementList,
                                                                               List<LotMovementViewModel> newAddedLotMovementList); @Override String toString();  }