mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
🔨 refactoring
This commit is contained in:
parent
a2f7a78c35
commit
9298afef4b
@ -1,62 +1,22 @@
|
|||||||
package com.gildedrose;
|
package com.gildedrose;
|
||||||
|
|
||||||
class GildedRose {
|
import java.util.List;
|
||||||
Item[] items;
|
|
||||||
|
|
||||||
public GildedRose(Item[] items) {
|
import static com.gildedrose.item_helpers.ItemFactory.getItem;
|
||||||
|
import static java.util.Collections.singletonList;
|
||||||
|
|
||||||
|
class GildedRose {
|
||||||
|
List<Item> items;
|
||||||
|
|
||||||
|
public GildedRose(List<Item> items) {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GildedRose(Item items) {
|
||||||
|
this.items = singletonList(items);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateQuality() {
|
public void updateQuality() {
|
||||||
for (int i = 0; i < items.length; i++) {
|
items.forEach(item -> getItem(item).updateQuality());
|
||||||
if (!items[i].name.equals("Aged Brie")
|
|
||||||
&& !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
if (items[i].quality > 0) {
|
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
|
||||||
items[i].quality = items[i].quality - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (items[i].quality < 50) {
|
|
||||||
items[i].quality = items[i].quality + 1;
|
|
||||||
|
|
||||||
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
if (items[i].sellIn < 11) {
|
|
||||||
if (items[i].quality < 50) {
|
|
||||||
items[i].quality = items[i].quality + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (items[i].sellIn < 6) {
|
|
||||||
if (items[i].quality < 50) {
|
|
||||||
items[i].quality = items[i].quality + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
|
||||||
items[i].sellIn = items[i].sellIn - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (items[i].sellIn < 0) {
|
|
||||||
if (!items[i].name.equals("Aged Brie")) {
|
|
||||||
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
if (items[i].quality > 0) {
|
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
|
||||||
items[i].quality = items[i].quality - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
items[i].quality = items[i].quality - items[i].quality;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (items[i].quality < 50) {
|
|
||||||
items[i].quality = items[i].quality + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,20 +4,23 @@ import com.gildedrose.Item;
|
|||||||
import com.gildedrose.items.AgedBrie;
|
import com.gildedrose.items.AgedBrie;
|
||||||
import com.gildedrose.items.BackstagePass;
|
import com.gildedrose.items.BackstagePass;
|
||||||
import com.gildedrose.items.Conjured;
|
import com.gildedrose.items.Conjured;
|
||||||
|
import com.gildedrose.items.Legendary;
|
||||||
import com.gildedrose.items.Normal;
|
import com.gildedrose.items.Normal;
|
||||||
import com.gildedrose.items.Sulfura;
|
|
||||||
|
|
||||||
import static com.gildedrose.item_helpers.ItemName.getItemName;
|
import static com.gildedrose.item_helpers.ItemName.getItemName;
|
||||||
|
|
||||||
public class ItemFactory {
|
public class ItemFactory {
|
||||||
|
|
||||||
public ItemType getItemType(Item item) {
|
private ItemFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemType getItem(Item item) {
|
||||||
ItemName itemName = getItemName(item.name);
|
ItemName itemName = getItemName(item.name);
|
||||||
switch (itemName) {
|
switch (itemName) {
|
||||||
case AGED_BRIE:
|
case AGED_BRIE:
|
||||||
return new AgedBrie(item);
|
return new AgedBrie(item);
|
||||||
case SULFURA:
|
case LEGENDARY:
|
||||||
return new Sulfura(item);
|
return new Legendary(item);
|
||||||
case BACKSTAGE_PASS:
|
case BACKSTAGE_PASS:
|
||||||
return new BackstagePass(item);
|
return new BackstagePass(item);
|
||||||
case CONJURED:
|
case CONJURED:
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import static java.lang.Math.max;
|
|||||||
|
|
||||||
public class ItemHandler {
|
public class ItemHandler {
|
||||||
|
|
||||||
private static final int QUALITY = 80;
|
private static final int LEGENDARY_ITEM_QUALITY = 80;
|
||||||
|
|
||||||
private final Item item;
|
private final Item item;
|
||||||
|
|
||||||
@ -15,61 +15,61 @@ public class ItemHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void decrementSellInDate() {
|
public void decrementSellInDate() {
|
||||||
this.item.sellIn--;
|
item.sellIn--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean beforeSellInDate() {
|
||||||
|
return item.sellIn >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementQualityByTwo() {
|
||||||
|
item.quality = max(item.quality + 2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementQuality() {
|
||||||
|
item.quality++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementQuality() {
|
||||||
|
item.quality--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementQualityBy4() {
|
||||||
|
item.quality = max(item.quality - 4, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementQualityBy2() {
|
||||||
|
item.quality = max(item.quality - 2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLegendaryQuality() {
|
||||||
|
if (item.quality != LEGENDARY_ITEM_QUALITY) {
|
||||||
|
item.quality = LEGENDARY_ITEM_QUALITY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sellInLessThan5Days() {
|
||||||
|
return item.sellIn >= 0 && item.sellIn <= 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sellInLessThan10Days() {
|
||||||
|
return item.sellIn >= 5 && item.sellIn <= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sellInDaysMoreThan10Days() {
|
||||||
|
return item.sellIn >= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean qualityIsHigherThanZero() {
|
public boolean qualityIsHigherThanZero() {
|
||||||
return item.quality > 0;
|
return item.quality > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean sellInDatePasses() {
|
|
||||||
return this.item.sellIn < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void incrementQualityByTwo() {
|
|
||||||
this.item.quality = max(this.item.quality + 2, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void incrementQuality() {
|
|
||||||
this.item.quality++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void decrementQuality() {
|
|
||||||
this.item.quality--;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void decrementQualityBy4() {
|
|
||||||
this.item.quality = max(this.item.quality - 4, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void decrementQualityBy2() {
|
|
||||||
this.item.quality = this.item.quality - 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQualityTo80() {
|
|
||||||
if (this.item.quality != QUALITY) {
|
|
||||||
this.item.quality = QUALITY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean sellInLessThan5Days() {
|
|
||||||
return this.item.sellIn >= 0 && this.item.sellIn <= 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean sellInLessThan10Days() {
|
|
||||||
return this.item.sellIn >= 5 && this.item.sellIn <= 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean sellInDaysMoreThan10Days() {
|
|
||||||
return this.item.sellIn >= 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void makeQualityZero() {
|
public void makeQualityZero() {
|
||||||
this.item.quality = 0;
|
item.quality = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementQualityBy3() {
|
public void incrementQualityBy3() {
|
||||||
this.item.quality = this.item.quality + 3;
|
item.quality = max(item.quality + 3, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,11 @@ package com.gildedrose.item_helpers;
|
|||||||
|
|
||||||
public enum ItemName {
|
public enum ItemName {
|
||||||
|
|
||||||
SULFURA("Sulfura"),
|
LEGENDARY("Sulfuras, Hand of Ragnaros"),
|
||||||
NORMAL("Normal"),
|
NORMAL("Normal"),
|
||||||
AGED_BRIE("Aged Brie"),
|
AGED_BRIE("Aged Brie"),
|
||||||
BACKSTAGE_PASS("Backstage pass"),
|
BACKSTAGE_PASS("Backstage passes to a TAFKAL80ETC concert"),
|
||||||
CONJURED("Conjured");
|
CONJURED("Conjured Mana Cake");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
@ -21,9 +21,9 @@ public enum ItemName {
|
|||||||
|
|
||||||
public static ItemName getItemName(String input) {
|
public static ItemName getItemName(String input) {
|
||||||
for (ItemName itemName : ItemName.values()) {
|
for (ItemName itemName : ItemName.values()) {
|
||||||
String itemNameStr = itemName.toString().toUpperCase();
|
if (itemName.name.equalsIgnoreCase(input)) {
|
||||||
if (itemNameStr.contains(input.toUpperCase()))
|
|
||||||
return itemName;
|
return itemName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NORMAL;
|
return NORMAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,12 +15,10 @@ public class AgedBrie implements ItemType {
|
|||||||
@Override
|
@Override
|
||||||
public void updateQuality() {
|
public void updateQuality() {
|
||||||
item.decrementSellInDate();
|
item.decrementSellInDate();
|
||||||
if (item.qualityIsHigherThanZero()) {
|
if (item.beforeSellInDate()) {
|
||||||
if (item.sellInDatePasses()) {
|
item.incrementQuality();
|
||||||
item.incrementQualityByTwo();
|
} else {
|
||||||
} else {
|
item.incrementQualityByTwo();
|
||||||
item.incrementQuality();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,12 +16,11 @@ public class Conjured implements ItemType {
|
|||||||
public void updateQuality() {
|
public void updateQuality() {
|
||||||
item.decrementSellInDate();
|
item.decrementSellInDate();
|
||||||
if (item.qualityIsHigherThanZero()) {
|
if (item.qualityIsHigherThanZero()) {
|
||||||
if (item.sellInDatePasses()) {
|
if (item.beforeSellInDate()) {
|
||||||
item.decrementQualityBy4();
|
|
||||||
} else {
|
|
||||||
item.decrementQuality();
|
item.decrementQuality();
|
||||||
|
} else {
|
||||||
|
item.decrementQualityBy4();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,18 +4,18 @@ import com.gildedrose.Item;
|
|||||||
import com.gildedrose.item_helpers.ItemHandler;
|
import com.gildedrose.item_helpers.ItemHandler;
|
||||||
import com.gildedrose.item_helpers.ItemType;
|
import com.gildedrose.item_helpers.ItemType;
|
||||||
|
|
||||||
public class Sulfura implements ItemType {
|
public class Legendary implements ItemType {
|
||||||
|
|
||||||
private final ItemHandler item;
|
private final ItemHandler item;
|
||||||
|
|
||||||
public Sulfura(Item item) {
|
public Legendary(Item item) {
|
||||||
this.item = new ItemHandler(item);
|
this.item = new ItemHandler(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateQuality() {
|
public void updateQuality() {
|
||||||
item.decrementSellInDate();
|
item.decrementSellInDate();
|
||||||
item.setQualityTo80();
|
item.setLegendaryQuality();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -16,10 +16,10 @@ public class Normal implements ItemType {
|
|||||||
public void updateQuality() {
|
public void updateQuality() {
|
||||||
item.decrementSellInDate();
|
item.decrementSellInDate();
|
||||||
if (item.qualityIsHigherThanZero()) {
|
if (item.qualityIsHigherThanZero()) {
|
||||||
if (item.sellInDatePasses()) {
|
if (item.beforeSellInDate()) {
|
||||||
item.decrementQualityBy2();
|
|
||||||
} else {
|
|
||||||
item.decrementQuality();
|
item.decrementQuality();
|
||||||
|
} else {
|
||||||
|
item.decrementQualityBy2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,30 +1,32 @@
|
|||||||
package com.gildedrose;
|
package com.gildedrose;
|
||||||
|
|
||||||
import com.gildedrose.item_helpers.ItemFactory;
|
|
||||||
import com.gildedrose.item_helpers.ItemType;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.gildedrose.item_helpers.ItemName.*;
|
import static com.gildedrose.item_helpers.ItemName.*;
|
||||||
|
import static java.util.Collections.singletonList;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
class GildedRoseTest {
|
class GildedRoseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void foo() {
|
void foo() {
|
||||||
Item[] items = new Item[]{new Item("foo", 0, 0)};
|
List<Item> items = singletonList(new Item("foo", 0, 0));
|
||||||
GildedRose app = new GildedRose(items);
|
GildedRose app = new GildedRose(items);
|
||||||
app.updateQuality();
|
app.updateQuality();
|
||||||
assertEquals("foo", app.items[0].name);
|
assertEquals("foo", app.items.get(0).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testNormalItem() {
|
void testNormalItem() {
|
||||||
ItemFactory itemFactory = new ItemFactory();
|
|
||||||
int days = 20;
|
int days = 20;
|
||||||
Item normalItem = new Item(NORMAL.toString(), 10, 20);
|
Item normalItem = new Item(NORMAL.toString(), 10, 20);
|
||||||
|
GildedRose app = new GildedRose(normalItem);
|
||||||
|
app.updateQuality();
|
||||||
for (int i = 0; i < days; i++) {
|
for (int i = 0; i < days; i++) {
|
||||||
ItemType itemType = itemFactory.getItemType(normalItem);
|
app.updateQuality();
|
||||||
itemType.updateQuality();
|
|
||||||
System.out.println("name, sell-in, quality");
|
System.out.println("name, sell-in, quality");
|
||||||
System.out.println(normalItem);
|
System.out.println(normalItem);
|
||||||
}
|
}
|
||||||
@ -32,12 +34,11 @@ class GildedRoseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testConjuredItem() {
|
void testConjuredItem() {
|
||||||
ItemFactory itemFactory = new ItemFactory();
|
|
||||||
int days = 20;
|
int days = 20;
|
||||||
Item normalItem = new Item(CONJURED.toString(), 10, 40);
|
Item normalItem = new Item(CONJURED.toString(), 10, 40);
|
||||||
|
GildedRose app = new GildedRose(normalItem);
|
||||||
for (int i = 0; i < days; i++) {
|
for (int i = 0; i < days; i++) {
|
||||||
ItemType itemType = itemFactory.getItemType(normalItem);
|
app.updateQuality();
|
||||||
itemType.updateQuality();
|
|
||||||
System.out.println("name, sell-in, quality");
|
System.out.println("name, sell-in, quality");
|
||||||
System.out.println(normalItem);
|
System.out.println(normalItem);
|
||||||
}
|
}
|
||||||
@ -46,40 +47,39 @@ class GildedRoseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSulfuraItem() {
|
void testSulfuraItem() {
|
||||||
ItemFactory itemFactory = new ItemFactory();
|
|
||||||
int days = 20;
|
int days = 20;
|
||||||
Item normalItem = new Item(SULFURA.toString(), 10, 40);
|
Item legendaryItem = new Item(LEGENDARY.toString(), 10, 40);
|
||||||
|
GildedRose app = new GildedRose(legendaryItem);
|
||||||
for (int i = 0; i < days; i++) {
|
for (int i = 0; i < days; i++) {
|
||||||
ItemType itemType = itemFactory.getItemType(normalItem);
|
app.updateQuality();
|
||||||
itemType.updateQuality();
|
|
||||||
System.out.println("name, sell-in, quality");
|
System.out.println("name, sell-in, quality");
|
||||||
System.out.println(normalItem);
|
System.out.println(legendaryItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testAgedBrieItem() {
|
void testAgedBrieItem() {
|
||||||
ItemFactory itemFactory = new ItemFactory();
|
|
||||||
int days = 20;
|
int days = 20;
|
||||||
Item normalItem = new Item(AGED_BRIE.toString(), 10, 40);
|
Item agedBrie = new Item(AGED_BRIE.toString(), 10, 40);
|
||||||
|
GildedRose app = new GildedRose(agedBrie);
|
||||||
for (int i = 0; i < days; i++) {
|
for (int i = 0; i < days; i++) {
|
||||||
ItemType itemType = itemFactory.getItemType(normalItem);
|
app.updateQuality();
|
||||||
itemType.updateQuality();
|
|
||||||
System.out.println("name, sell-in, quality");
|
System.out.println("name, sell-in, quality");
|
||||||
System.out.println(normalItem);
|
System.out.println(agedBrie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testBackstagePassItem() {
|
void testBackstagePassItem() {
|
||||||
ItemFactory itemFactory = new ItemFactory();
|
|
||||||
int days = 20;
|
int days = 20;
|
||||||
Item normalItem = new Item(BACKSTAGE_PASS.toString(), 15, 40);
|
List<Item> backStagePass = Arrays.asList(new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
||||||
|
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||||
|
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49));
|
||||||
|
GildedRose app = new GildedRose(backStagePass);
|
||||||
for (int i = 0; i < days; i++) {
|
for (int i = 0; i < days; i++) {
|
||||||
ItemType itemType = itemFactory.getItemType(normalItem);
|
app.updateQuality();
|
||||||
itemType.updateQuality();
|
|
||||||
System.out.println("name, sell-in, quality");
|
System.out.println("name, sell-in, quality");
|
||||||
System.out.println(normalItem);
|
System.out.println(backStagePass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,22 +1,24 @@
|
|||||||
package com.gildedrose;
|
package com.gildedrose;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
public class TexttestFixture {
|
public class TexttestFixture {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("OMGHAI!");
|
System.out.println("OMGHAI!");
|
||||||
|
|
||||||
Item[] items = new Item[] {
|
Item[] items = new Item[]{
|
||||||
new Item("+5 Dexterity Vest", 10, 20), //
|
new Item("Aged Brie", 2, 0), //
|
||||||
new Item("Aged Brie", 2, 0), //
|
new Item("+5 Dexterity Vest", 10, 20), //
|
||||||
new Item("Elixir of the Mongoose", 5, 7), //
|
new Item("Elixir of the Mongoose", 5, 7), //
|
||||||
new Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
new Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
||||||
new Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
new Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
||||||
new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
||||||
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||||
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
||||||
// this conjured item does not work properly yet
|
// this conjured item does not work properly yet
|
||||||
new Item("Conjured Mana Cake", 3, 6) };
|
new Item("Conjured Mana Cake", 3, 6)};
|
||||||
|
|
||||||
GildedRose app = new GildedRose(items);
|
GildedRose app = new GildedRose(asList(items));
|
||||||
|
|
||||||
int days = 2;
|
int days = 2;
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
|
|||||||
@ -1,22 +1,24 @@
|
|||||||
package com.gildedrose;
|
package com.gildedrose;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
public class TexttestFixtureTemp {
|
public class TexttestFixtureTemp {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("OMGHAI!");
|
System.out.println("OMGHAI!");
|
||||||
|
|
||||||
Item[] items = new Item[] {
|
Item[] items = new Item[]{
|
||||||
new Item("+5 Dexterity Vest", 10, 20), //
|
new Item("+5 Dexterity Vest", 10, 20), //
|
||||||
new Item("Aged Brie", 2, 0), //
|
new Item("Aged Brie", 2, 0), //
|
||||||
new Item("Elixir of the Mongoose", 5, 7), //
|
new Item("Elixir of the Mongoose", 5, 7), //
|
||||||
new Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
new Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
||||||
new Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
new Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
||||||
new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
||||||
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||||
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
||||||
// this conjured item does not work properly yet
|
// this conjured item does not work properly yet
|
||||||
new Item("Conjured Mana Cake", 3, 6) };
|
new Item("Conjured Mana Cake", 3, 6)};
|
||||||
|
|
||||||
GildedRose app = new GildedRose(items);
|
GildedRose app = new GildedRose(asList(items));
|
||||||
|
|
||||||
int days = 20;
|
int days = 20;
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user