StockCard extends BaseModel implements Comparable<StockCard> { public float getCMM() { return (int) (this.avgMonthlyConsumption * 100 + 0.5) / 100f; }  @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 shouldGetCMM() throws Exception { stockCard.setAvgMonthlyConsumption(0.7777777f); assertThat(stockCard.getCMM(), is(0.78f)); stockCard.setAvgMonthlyConsumption(12.3849f); assertThat(stockCard.getCMM(), is(12.38f)); stockCard.setAvgMonthlyConsumption(2234f); assertThat(stockCard.getCMM(), is(2234f)); }