mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 23:41:27 +00:00
Item class SellIn is mutable
This commit is contained in:
parent
29586834b4
commit
676f6facda
@ -11,4 +11,8 @@ public class BaseItem {
|
|||||||
public int getSellIn() {
|
public int getSellIn() {
|
||||||
return item.sellIn;
|
return item.sellIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSellIn(int sellIn) {
|
||||||
|
this.item.sellIn = sellIn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,4 +12,11 @@ class BaseItemTest {
|
|||||||
BaseItem baseItem = new BaseItem(new Item("foo", 10, 20));
|
BaseItem baseItem = new BaseItem(new Item("foo", 10, 20));
|
||||||
assertEquals(10, baseItem.getSellIn());
|
assertEquals(10, baseItem.getSellIn());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void itMutatesTheSellInValueOfTheItem() {
|
||||||
|
BaseItem baseItem = new BaseItem(new Item("foo", 10, 20));
|
||||||
|
baseItem.setSellIn(9);
|
||||||
|
assertEquals(9, baseItem.getSellIn());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user