OrderLineItem { public Double price() { return product.singleUnitPrice() * amount; } OrderLineItem(Product product, int amount); int amount(); Product product(); Double price(); @Override String toString();  }
@Test public void shouldCalculateItsOwnPrice() throws Exception { OrderLineItem orderLineItem = new OrderLineItem(new Product("a product", "ItemXXX", 5d, "meter", null), 5); Double linePrice = orderLineItem.price(); assertThat(linePrice, is(25d)); }