Simplified the scaffolding

This commit is contained in:
Dipanjan Bhowmik 2021-10-11 08:58:34 +05:30
parent 452a67ca2e
commit 11a5938e49
2 changed files with 9 additions and 13 deletions

View File

@ -7,14 +7,12 @@ import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class StepDefinitions {
private String savedName;
private Item[] items = new Item[1];
private GildedRose app;
@Given("for {string} initial sellin is {int} and quality is {int}")
public void initial_sellin_is_and_quality_is(String name, int sellin, int quality) {
savedName = name;
items[0] = new Item(name, sellin, quality);
@Given("The item as {string}")
public void initial_sellin_is_and_quality_is(String name) {
items[0] = new Item(name, 0, 0);
app = new GildedRose(items);
}
@ -23,11 +21,9 @@ public class StepDefinitions {
app.updateQuality();
}
@Then("I should get sellin as {int} and quality as {int}")
public void i_should_get_sellin_as_and_quality_as(int sellin, int quality) {
assertEquals(savedName, app.items[0].name);
assertEquals(sellin, app.items[0].sellIn);
assertEquals(quality, app.items[0].quality);
@Then("I should get item as {string}")
public void i_should_get_sellin_as_and_quality_as(String expected) {
assertEquals(expected, app.items[0].name);
}
}

View File

@ -1,7 +1,7 @@
Feature: Gilded Rose quality
I want to know if the quality is updated properly
Scenario: Sellin and Quality decreasing
Given for "+5 Dexterity Vest" initial sellin is 20 and quality is 30
Scenario: Checking foo
Given The item as "fixme"
When I update the quality
Then I should get sellin as 19 and quality as 29
Then I should get item as "foo"