From b12a345e6ceeeadb0630212c4ba0c1bc4e378af5 Mon Sep 17 00:00:00 2001 From: Luciano Minuzzi Date: Sat, 2 May 2020 19:33:32 +0200 Subject: [PATCH] - Increase project information in README.md; - Refactor the foo test into "+5 Dexterity Vest" item test; --- Java/README.md | 152 +++++++++++++++++- .../java/com/gildedrose/GildedRoseTest.java | 22 ++- 2 files changed, 167 insertions(+), 7 deletions(-) diff --git a/Java/README.md b/Java/README.md index 4feae1b7..da5135ae 100644 --- a/Java/README.md +++ b/Java/README.md @@ -1,4 +1,4 @@ -

How to Run Tests:

+

How to Run Tests

+ +

The System

+ + +

New Requisites

+ + +

Restrictions

+ + +

Original Output

+ +
OMGHAI!
+
-------- day 0 --------
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
namesellInquality
+5 Dexterity Vest1020
Aged Brie20
Elixir of the Mongoose57
Sulfuras, Hand of Ragnaros080
Sulfuras, Hand of Ragnaros-180
Backstage passes to a TAFKAL80ETC concert1520
Backstage passes to a TAFKAL80ETC concert1049
Backstage passes to a TAFKAL80ETC concert549
Conjured Mana Cake36
+
-------- day 1 --------
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
namesellInquality
+5 Dexterity Vest919
Aged Brie11
Elixir of the Mongoose46
Sulfuras, Hand of Ragnaros080
Sulfuras, Hand of Ragnaros-180
Backstage passes to a TAFKAL80ETC concert1421
Backstage passes to a TAFKAL80ETC concert950
Backstage passes to a TAFKAL80ETC concert450
Conjured Mana Cake25
\ No newline at end of file diff --git a/Java/src/test/java/com/gildedrose/GildedRoseTest.java b/Java/src/test/java/com/gildedrose/GildedRoseTest.java index 8ae29eec..9e61b788 100644 --- a/Java/src/test/java/com/gildedrose/GildedRoseTest.java +++ b/Java/src/test/java/com/gildedrose/GildedRoseTest.java @@ -2,16 +2,26 @@ package com.gildedrose; import org.junit.jupiter.api.Test; +import java.util.stream.IntStream; + import static org.junit.jupiter.api.Assertions.assertEquals; class GildedRoseTest { @Test - void foo() { - Item[] items = new Item[] { new Item("foo", 0, 0) }; - GildedRose app = new GildedRose(items); - app.updateQuality(); - assertEquals("fixme", app.items[0].name); - } + void dexterityVestShouldDecreaseSellInAndQualityEachUpdate() { + String name = "+5 Dexterity Vest"; + int sellIn = 10; + int quality = 20; + int days = 2; + Item[] items = new Item[]{new Item(name, sellIn, quality)}; + GildedRose app = new GildedRose(items); + IntStream.rangeClosed(1, days).forEach(index -> { + app.updateQuality(); + assertEquals(name, app.items[0].name); + assertEquals(sellIn - index, app.items[0].sellIn); + assertEquals(quality - index, app.items[0].quality); + }); + } }