diff --git a/Java/.classpath b/Java/.classpath
deleted file mode 100644
index 3f0dbd34..00000000
--- a/Java/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/Java/.gitignore b/Java/.gitignore
index 2d7e4dc5..69f580e0 100644
--- a/Java/.gitignore
+++ b/Java/.gitignore
@@ -1 +1,8 @@
-*.class
+.idea/
+*.iml
+target/
+
+.classpath
+.project
+bin/
+.settings/
diff --git a/Java/.project b/Java/.project
deleted file mode 100644
index a27d7900..00000000
--- a/Java/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- GildedRose.java
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/Java/Java.iml b/Java/Java.iml
deleted file mode 100644
index 9d782ec3..00000000
--- a/Java/Java.iml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Java/pom.xml b/Java/pom.xml
new file mode 100644
index 00000000..6add3690
--- /dev/null
+++ b/Java/pom.xml
@@ -0,0 +1,37 @@
+
+
+
+ 4.0.0
+
+ com.gildedrose
+ gilded-rose-kata
+ 0.0.1-SNAPSHOT
+
+
+ 1.8
+
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+
+
+
+
+ maven-compiler-plugin
+
+ ${java.version}
+ ${java.version}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Java/com/gildedrose/GildedRose.java b/Java/src/main/java/com.gildedrose/GildedRose.java
similarity index 97%
rename from Java/com/gildedrose/GildedRose.java
rename to Java/src/main/java/com.gildedrose/GildedRose.java
index ff5e55ae..87a3b926 100644
--- a/Java/com/gildedrose/GildedRose.java
+++ b/Java/src/main/java/com.gildedrose/GildedRose.java
@@ -1,62 +1,62 @@
-package com.gildedrose;
-
-class GildedRose {
- Item[] items;
-
- public GildedRose(Item[] items) {
- this.items = items;
- }
-
- public void updateQuality() {
- for (int i = 0; i < items.length; i++) {
- 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;
- }
- }
- }
- }
- }
-}
+package com.gildedrose;
+
+class GildedRose {
+ Item[] items;
+
+ public GildedRose(Item[] items) {
+ this.items = items;
+ }
+
+ public void updateQuality() {
+ for (int i = 0; i < items.length; i++) {
+ 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;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Java/com/gildedrose/Item.java b/Java/src/main/java/com.gildedrose/Item.java
similarity index 94%
rename from Java/com/gildedrose/Item.java
rename to Java/src/main/java/com.gildedrose/Item.java
index 65b02c6b..465729ec 100644
--- a/Java/com/gildedrose/Item.java
+++ b/Java/src/main/java/com.gildedrose/Item.java
@@ -1,21 +1,21 @@
-package com.gildedrose;
-
-public class Item {
-
- public String name;
-
- public int sellIn;
-
- public int quality;
-
- public Item(String name, int sellIn, int quality) {
- this.name = name;
- this.sellIn = sellIn;
- this.quality = quality;
- }
-
- @Override
- public String toString() {
- return this.name + ", " + this.sellIn + ", " + this.quality;
- }
-}
+package com.gildedrose;
+
+public class Item {
+
+ public String name;
+
+ public int sellIn;
+
+ public int quality;
+
+ public Item(String name, int sellIn, int quality) {
+ this.name = name;
+ this.sellIn = sellIn;
+ this.quality = quality;
+ }
+
+ @Override
+ public String toString() {
+ return this.name + ", " + this.sellIn + ", " + this.quality;
+ }
+}
diff --git a/Java/src/main/java/com/gildedrose/GildedRose.java b/Java/src/main/java/com/gildedrose/GildedRose.java
new file mode 100644
index 00000000..a334fa0a
--- /dev/null
+++ b/Java/src/main/java/com/gildedrose/GildedRose.java
@@ -0,0 +1,72 @@
+package com.gildedrose;
+
+class GildedRose {
+ Item[] items;
+
+ public GildedRose(Item[] items) {
+ this.items = items;
+ }
+
+ public void updateQuality() {
+ for (int i = 0; i < items.length; i++) {
+ 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 increaseQuality(items[i]);
+
+ if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
+ items[i].sellIn = items[i].sellIn - 1;
+ }
+
+ if (items[i].sellIn < 0) {
+ handlePastSellin(items[i]);
+ }
+ }
+ }
+
+ private void handlePastSellin(Item item) {
+ if (!item.name.equals("Aged Brie")) {
+ if (!item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
+ if (item.quality > 0) {
+ if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
+ item.quality = item.quality - 1;
+ }
+ }
+ } else {
+ item.quality = 0;
+ }
+ } else {
+ if (item.quality < 50) {
+ item.quality = item.quality + 1;
+ }
+ }
+ }
+
+ private void increaseQuality(Item item) {
+ if (item.quality < 50) {
+ item.quality = item.quality + 1;
+
+ if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
+ handleBackstagePass(item);
+ }
+ }
+ }
+
+ private void handleBackstagePass(Item backstagePass) {
+ if (backstagePass.sellIn < 11) {
+ if (backstagePass.quality < 50) {
+ backstagePass.quality = backstagePass.quality + 1;
+ }
+ }
+
+ if (backstagePass.sellIn < 6) {
+ if (backstagePass.quality < 50) {
+ backstagePass.quality = backstagePass.quality + 1;
+ }
+ }
+ }
+}
diff --git a/Java/src/main/java/com/gildedrose/Item.java b/Java/src/main/java/com/gildedrose/Item.java
new file mode 100644
index 00000000..465729ec
--- /dev/null
+++ b/Java/src/main/java/com/gildedrose/Item.java
@@ -0,0 +1,21 @@
+package com.gildedrose;
+
+public class Item {
+
+ public String name;
+
+ public int sellIn;
+
+ public int quality;
+
+ public Item(String name, int sellIn, int quality) {
+ this.name = name;
+ this.sellIn = sellIn;
+ this.quality = quality;
+ }
+
+ @Override
+ public String toString() {
+ return this.name + ", " + this.sellIn + ", " + this.quality;
+ }
+}
diff --git a/Java/com/gildedrose/GildedRoseTest.java b/Java/src/test/java/com.gildedrose/GildedRoseTest.java
similarity index 95%
rename from Java/com/gildedrose/GildedRoseTest.java
rename to Java/src/test/java/com.gildedrose/GildedRoseTest.java
index d679c458..95bfddc4 100644
--- a/Java/com/gildedrose/GildedRoseTest.java
+++ b/Java/src/test/java/com.gildedrose/GildedRoseTest.java
@@ -1,17 +1,17 @@
-package com.gildedrose;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class GildedRoseTest {
-
- @Test
- public void foo() {
- Item[] items = new Item[] { new Item("foo", 0, 0) };
- GildedRose app = new GildedRose(items);
- app.updateQuality();
- assertEquals("fixme", app.items[0].name);
- }
-
-}
+package com.gildedrose;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class GildedRoseTest {
+
+ @Test
+ public void foo() {
+ Item[] items = new Item[] { new Item("foo", 0, 0) };
+ GildedRose app = new GildedRose(items);
+ app.updateQuality();
+ assertEquals("fixme", app.items[0].name);
+ }
+
+}
diff --git a/Java/com/gildedrose/TexttestFixture.java b/Java/src/test/java/com.gildedrose/TexttestFixture.java
similarity index 97%
rename from Java/com/gildedrose/TexttestFixture.java
rename to Java/src/test/java/com.gildedrose/TexttestFixture.java
index 821b7f1d..d059c88f 100644
--- a/Java/com/gildedrose/TexttestFixture.java
+++ b/Java/src/test/java/com.gildedrose/TexttestFixture.java
@@ -1,37 +1,37 @@
-package com.gildedrose;
-
-public class TexttestFixture {
- public static void main(String[] args) {
- System.out.println("OMGHAI!");
-
- Item[] items = new Item[] {
- new Item("+5 Dexterity Vest", 10, 20), //
- new Item("Aged Brie", 2, 0), //
- new Item("Elixir of the Mongoose", 5, 7), //
- new Item("Sulfuras, Hand of Ragnaros", 0, 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", 10, 49),
- new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
- // this conjured item does not work properly yet
- new Item("Conjured Mana Cake", 3, 6) };
-
- GildedRose app = new GildedRose(items);
-
- int days = 2;
- if (args.length > 0) {
- days = Integer.parseInt(args[0]) + 1;
- }
-
- for (int i = 0; i < days; i++) {
- System.out.println("-------- day " + i + " --------");
- System.out.println("name, sellIn, quality");
- for (Item item : items) {
- System.out.println(item);
- }
- System.out.println();
- app.updateQuality();
- }
- }
-
-}
+package com.gildedrose;
+
+public class TexttestFixture {
+ public static void main(String[] args) {
+ System.out.println("OMGHAI!");
+
+ Item[] items = new Item[] {
+ new Item("+5 Dexterity Vest", 10, 20), //
+ new Item("Aged Brie", 2, 0), //
+ new Item("Elixir of the Mongoose", 5, 7), //
+ new Item("Sulfuras, Hand of Ragnaros", 0, 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", 10, 49),
+ new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
+ // this conjured item does not work properly yet
+ new Item("Conjured Mana Cake", 3, 6) };
+
+ GildedRose app = new GildedRose(items);
+
+ int days = 2;
+ if (args.length > 0) {
+ days = Integer.parseInt(args[0]) + 1;
+ }
+
+ for (int i = 0; i < days; i++) {
+ System.out.println("-------- day " + i + " --------");
+ System.out.println("name, sellIn, quality");
+ for (Item item : items) {
+ System.out.println(item);
+ }
+ System.out.println();
+ app.updateQuality();
+ }
+ }
+
+}
diff --git a/Java/src/test/java/com/gildedrose/GildedRoseTest.java b/Java/src/test/java/com/gildedrose/GildedRoseTest.java
new file mode 100644
index 00000000..95bfddc4
--- /dev/null
+++ b/Java/src/test/java/com/gildedrose/GildedRoseTest.java
@@ -0,0 +1,17 @@
+package com.gildedrose;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class GildedRoseTest {
+
+ @Test
+ public void foo() {
+ Item[] items = new Item[] { new Item("foo", 0, 0) };
+ GildedRose app = new GildedRose(items);
+ app.updateQuality();
+ assertEquals("fixme", app.items[0].name);
+ }
+
+}
diff --git a/Java/src/test/java/com/gildedrose/TexttestFixture.java b/Java/src/test/java/com/gildedrose/TexttestFixture.java
new file mode 100644
index 00000000..d059c88f
--- /dev/null
+++ b/Java/src/test/java/com/gildedrose/TexttestFixture.java
@@ -0,0 +1,37 @@
+package com.gildedrose;
+
+public class TexttestFixture {
+ public static void main(String[] args) {
+ System.out.println("OMGHAI!");
+
+ Item[] items = new Item[] {
+ new Item("+5 Dexterity Vest", 10, 20), //
+ new Item("Aged Brie", 2, 0), //
+ new Item("Elixir of the Mongoose", 5, 7), //
+ new Item("Sulfuras, Hand of Ragnaros", 0, 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", 10, 49),
+ new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
+ // this conjured item does not work properly yet
+ new Item("Conjured Mana Cake", 3, 6) };
+
+ GildedRose app = new GildedRose(items);
+
+ int days = 2;
+ if (args.length > 0) {
+ days = Integer.parseInt(args[0]) + 1;
+ }
+
+ for (int i = 0; i < days; i++) {
+ System.out.println("-------- day " + i + " --------");
+ System.out.println("name, sellIn, quality");
+ for (Item item : items) {
+ System.out.println(item);
+ }
+ System.out.println();
+ app.updateQuality();
+ }
+ }
+
+}