public Ingredients getIngredient(String name) { Ingredients ingridient = null; for (Ingredients ing : prices) { if (ing.getName().equals(name)) ingridient = ing; } return ingridient; }
@Test public void should_create_produit_compose_with_ingredients() { List<Ingredient> ingredients = Ingredients.createIngredients("cornichons", .3, 2); ingredients.addAll(Ingredients.createIngredients("tomate", .5, 1)); ingredients.addAll(Ingredients.createIngredients("steack", 1, 1)); Produit bigMac = ProduitsEnVente.createProduits( "Big Mac", 4.5, ingredients.toArray(new Ingredient[ingredients.size()])); }
@Test public void should_create_new_ingredient() { List<Ingredient> tomates = Ingredients.createIngredients("tomate", 2.5, 10); assertThat(tomates).hasSize(10); }