StockCard extends BaseModel implements Comparable<StockCard> { public boolean isOverStock() { return product.isHiv() ? stockOnHand > (int) Math.ceil(this.avgMonthlyConsumption * 3) : stockOnHand > (int) Math.ceil(this.avgMonthlyConsumption * 2); }  @Override int compareTo(@NonNull StockCard another); @Override boolean equals(Object o); @Override int hashCode(); StockMovementItem generateInitialStockMovementItem(); List<StockMovementItem> getStockMovementItemsWrapper(); float getCMM(); boolean isOverStock(); boolean isLowStock(); long calculateSOHFromLots(); List<LotOnHand> getLotOnHandListWrapper(); Date getEarliestLotExpiryDate(); Date getLastStockMovementDate(); Date getLastStockMovementCreatedTime(); List<LotOnHand> getNonEmptyLotOnHandList(); List<LotOnHand> getNoneExpiredLotOnHandList(); @Override String toString(); static final String DIVIDER; }
@Test public void shouldGetOverStockAvg() throws Exception { stockCard.setStockOnHand(220); stockCard.setAvgMonthlyConsumption(100.5f); assertTrue(stockCard.isOverStock()); }