ProductItems { public static Function<ProductItem, Float> capacity() { return new Function<ProductItem, Float>() { @Override public Float apply(ProductItem productItem) { return productItem.getCapacity(); } }; }  static Function<ProductItem, Float> capacity(); static Function<ProductItem, String> description(); static Function<ProductItem, ProductItemPrice> price(); static Function<ProductItemPrice, ProductItem> item();  }
@Test public void testCapacity() { assertEquals(capacity().apply(item), 2.0f); }
@Test public void testCapacityMissing() { ProductItem item = ProductItem.builder().id(1).build(); assertNull(capacity().apply(item)); }