/gilded-rose-java

Mirrored from https://gitlab.com/NielsRenard/gilded-rose-java

Primary LanguageJava

GildedRose code refactoring kata

Had some fun with Java doing the GildedRose code refactoring kata.

Learned a bunch about java.util.Arrays and bumped my head a couple times forgetting that nearly every copy operation does a shallow copy.

Requirements

Find the requirements (and restrictions!) for this kata here: Gilded Rose Requirements

Before/After & Tests

For the "before" code, click here

For the refactored code click here

For the tests I wrote click here

How to run

If you have (gnu) Make available, in a terminal, run:

make run

Or, to skip the build for subsequent runs you can use:

make go

If you're on a system without Make, run it as such:

mvn package

java -jar ./target/gilded-rose-kata-0.3.1-SNAPSHOT-jar-with-dependencies.jar

You should see something like this:

Welcome to the Gilded Rose inventory management system
Press Enter key to move to the next day.
Or q to quit.

-------- day 0 --------
name, sellIn, quality
+5 Dexterity Vest, 10, 20
Aged Brie, 2, 0
Elixir of the Mongoose, 5, 7
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 15, 20
Backstage passes to a TAFKAL80ETC concert, 10, 49
Backstage passes to a TAFKAL80ETC concert, 0, 49
Conjured Mana Cake, 3, 6

Press Enter key to move to the next day.
Or q to quit.

-------- day 1 --------
name, sellIn, quality
+5 Dexterity Vest, 9, 19
Aged Brie, 1, 1
Elixir of the Mongoose, 4, 6
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 14, 21
Backstage passes to a TAFKAL80ETC concert, 9, 50
Backstage passes to a TAFKAL80ETC concert, -1, 0
Conjured Mana Cake, 2, 4

Press Enter key to move to the next day.
Or q to quit.