LotMovementViewModel implements Serializable { public long getAdjustmentQuantity() { long returnLong = 0; try { if (StringUtils.isBlank(lotSoh)) { returnLong = Long.parseLong(quantity); } returnLong = (Long.parseLong(this.getQuantity()) - Long.parseLong(this.getLotSoh())); } catch (NumberFormatException e) { new LMISException(e, "LotMovementViewModel.getAdjustmentQuantity").reportToFabric(); } return returnLong; } LotMovementViewModel(String lotNumber, String expiryDate, MovementReasonManager.MovementType movementType);  LotMovementViewModel(String lotNumber, String expiryDate, String quantityOnHand, MovementReasonManager.MovementType movementType);  LotMovementViewModel(String lotNumber, String expiryDate, MovementReasonManager.MovementType movementType, String quantity); boolean validateQuantityNotGreaterThanSOH(); LotMovementItem convertViewToModel(Product product); boolean quantityGreaterThanZero(); LotMovementItem convertViewToModelAndResetSOH(Product product); boolean validateLotWithPositiveQuantity(); boolean validateLotWithNoEmptyFields(); boolean isExpiredLot(); boolean isNewAdded(); static String generateLotNumberForProductWithoutLot(String productCode, String expiryDate); long getAdjustmentQuantity(); @Override String toString();  }
@Test public void shouldGetAdjustmentQuantity() throws Exception { viewModel.setQuantity("1"); viewModel.setLotSoh(null); assertEquals(1, viewModel.getAdjustmentQuantity()); viewModel.setLotSoh("1"); assertEquals(0, viewModel.getAdjustmentQuantity()); viewModel.setQuantity("10"); assertEquals(9, viewModel.getAdjustmentQuantity()); }