CalculatedAttributesUtil { public void setQuantityAttributes(Pool pool, Consumer c, Date date) { List<Pool> poolList = new ArrayList<>(); poolList.add(pool); setQuantityAttributes(poolList, c, date); } @Inject  CalculatedAttributesUtil(QuantityRules quantityRules, I18n i18n); Map<String, String> buildCalculatedAttributes(Pool pool, Date date); void setCalculatedAttributes(List<Pool> poolList, Date date); void setQuantityAttributes(Pool pool, Consumer c, Date date); void setQuantityAttributes(List<Pool> poolList, Consumer c, Date date);  }
@Test public void testQuantityIncrement() { Product product2 = TestUtil.createProduct("blah", "blah"); product2.setAttribute(Product.Attributes.INSTANCE_MULTIPLIER, "12"); productCurator.create(product2); Pool pool2 = createPool(owner1, product2, 500L, TestUtil.createDate(2000, 1, 1), TestUtil.createDate(3000, 1, 1)); SuggestedQuantityDTO suggested = new SuggestedQuantityDTO(); suggested.setSuggested(1L); suggested.setIncrement(12L); Map<String, SuggestedQuantityDTO> suggestedMap = new HashMap<>(); suggestedMap.put(pool2.getId(), suggested); when(quantityRules.getSuggestedQuantities(any(List.class), any(Consumer.class), any(Date.class))). thenReturn(suggestedMap); Date date = new Date(); attrUtil.setQuantityAttributes(pool2, consumer, date); assertEquals("1", pool2.getCalculatedAttributes().get("suggested_quantity")); assertEquals("12", pool2.getCalculatedAttributes().get("quantity_increment")); }