---
# System prepended metadata

title: Untitled

---

 We need to testing adding an item successfully and not being able to add a duplicate one **together** and **in the same scenario**:
  ```
  Scenario: Add a third menu item
    Given I have a menu item with name "Ice cream" and price 4
    When I add the menu item
    Then The menu item with name "Ice cream" should be added to the menu
    When I add the menu item
    Then The menu item with name "Ice cream" should be added to the menu
```
This of course will fail as expected:
```
java.lang.IllegalArgumentException: This menu item already exists!
```
And in order to fix the failure we need to update the feature file and consequentially the steps:
```
  Scenario: Add a third menu item
    Given I have a menu item with name "Ice cream" and price 4
    When I add the menu item
    Then The menu item with name "Ice cream" should be added to the menu
    When I add the same menu item again
    Then The menu item with name "Ice cream" should not be added to the menu
```
